Re: prompt w/ uid 0 for cshrc

看板FB_current作者時間12年前 (2013/04/27 12:33), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串6/7 (看更多)
On Mon, Nov 19, 2012 at 10:45:35AM -0500, Eitan Adler wrote: > On 18 November 2012 18:44, Mateusz Guzik <mjguzik@gmail.com> wrote: > > Just take user name from id -nu. > > While that does provide the $user value I want, id is in /usr/bin/ > which may not be mounted. > Is there a builtin which provides similar functionality? > Valid point, but should not happen a lot when unprivileged accounts are involved, so I suggest the following (pseudo-sh-code): if [ -x /usr/bin/id ]; then up=$(id -nu); else if [ $uid = 0 ]; then up="root"; else up="($uid)" fi -- Mateusz Guzik <mjguzik gmail.com> _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
文章代碼(AID): #1HUrK0jW (FB_current)
文章代碼(AID): #1HUrK0jW (FB_current)