Re: prompt w/ uid 0 for cshrc
On Nov 19, 2012, at 8:46 AM, jb wrote:
> Eitan Adler <lists <at> eitanadler.com> writes:
>
>>
>> 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.
>
> /rescue/id
Bad idea:
* /rescue tools are not part of the "standard" world
* /rescue tools are sometimes not installed
* Quite a few people have customized the rescue tools to adding or omitting things suitable for their particular installation.
* /rescue tools are not guaranteed to be functionally identical to the non-rescue versions.
Better to invoke 'id' in a way that produces
"reasonable" results if 'id' is unavailable.
For example:
/bin/sh -c 'id -nu 2>/dev/null' || echo '?'
prints '?' if the id command fails or is unavailable.
Tim
_______________________________________________
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"
討論串 (同標題文章)
完整討論串 (本文為第 7 之 7 篇):