Xref: utzoo unix-pc.general:2959 comp.sys.att:6571 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!bloom-beacon!think!ames!sun-barr!decwrl!ucbvax!agate!helios.ee.lbl.gov!nosc!humu!uhccux!richard From: richard@uhccux.uhcc.hawaii.edu (Richard Foulk) Newsgroups: unix-pc.general,comp.sys.att Subject: Re: Funny thing happened to me ... Beware of "$_" and the shell you run Keywords: /bin/sh, chmod, ooops. Message-ID: <4038@uhccux.uhcc.hawaii.edu> Date: 30 May 89 12:52:25 GMT References: <704@icus.islp.ny.us> Reply-To: richard@uhccux.UUCP (Richard Foulk) Distribution: usa Organization: University of Hawaii Lines: 23 } Normally I run /bin/ksh... so for those ksh people they know what "$_" does. } It basically returns the last argument in the previous command line. It's } normally used like so... } } # chown lenny /usr/mail/LENNY } # chgrp mail $_ } # chmod 660 $_ } } In the last two commands, $_ is substituted with /usr/mail/LENNY, it saves } on those keystokes ... } } Well that's normal and dandy for anyone running /bin/ksh, but what happens } if your shell is /bin/sh ... If you echo $_ while running /bin/sh, you'll } notice it returns /bin/sh. Now what happened to me... /bin/sh's group was } changed to mail, and the permission was 660. Ut oh. Well I didn't quite } notice this right away... I just logged out normally, thinking everything } was set. Looks like another good reason to stick with csh. !$ is easier to type and it displays the substitution so you know what's going on. Richard Foulk richard@uhccux.uhcc.hawaii.edu