[ale] UID variable in csh?

Fletch fletch at phydeaux.org
Wed Oct 30 10:17:30 EST 2002


>>>>> "cfowler" == cfowler  <cfowler at outpostsentinel.com> writes:

    cfowler> cat /etc/passwd | grep $LOGNAME | cut -d : -f 3

*tweet*

Useless use of cat.  5 yards, repeat the down. :)


grep $LOGNAME /etc/passwd | cut -d: -f 3


And just to eliminate the necessity for any more followups . . .


awk -F: "/$LOGNAME/{print \$3}" /etc/passwd
ypmatch $LOGNAME passwd | awk -F: '{print $3}'
perl -F: -lane '/$ENV{LOGNAME}/&&print$F[2]' /etc/passwd
perl -le 'print scalar getpwnam($ENV{LOGNAME})'
zsh -c 'echo $UID'
bash -c 'echo $UID'


Of course the better underlying question is why use csh in the first
place?   http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
770 294-0820 (m)      |  scary questions." -- Jules                =(___)=
                      |                                               U

---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list