On Mon, Nov 19, 2012 at 10:45:35AM -0500, Eitan Adler wrote: > On 18 November 2012 18:44, Mateusz Guzik <mjguzik_at_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>Received on Mon Nov 19 2012 - 18:15:33 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:32 UTC