whoami?
John F Haugh II
jfh at rpp386.cactus.org
Fri Dec 28 02:33:53 AEST 1990
In article <6537 at crash.cts.com> jca at pnet01.cts.com (John C. Archambeau) writes:
>What I want is something similiar to the BSD/SunOS whoami. For example, in a
>.cshrc file, I want to be able to do this:
>
>if (`whoami` == "root") then
> set prompt = "#"
>else
> set prompt = "%"
>endif
>
>Something like that. Somebody gave me a code fragment in e-mail that does
>return what I want, but shell scripts bomb. Any idea why?
Try something like this -
% id | sed -e 's/^[^(]*(\([^)]*\)).*$/\1/'
jfh
which would give you -
if ( `id | sed -e 's/^[^(]*(\([^)]*\)).*$/\1/'` == "root" ) then
set prompt = "#"
else
set prompt = "%"
endif
--
John F. Haugh II UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832 Domain: jfh at rpp386.cactus.org
"While you are here, your wives and girlfriends are dating handsome American
movie and TV stars. Stars like Tom Selleck, Bruce Willis, and Bart Simpson."
More information about the Comp.unix.xenix.sco
mailing list