Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!ncrlnk!adds!tanya From: tanya@adds.newyork.NCR.COM (Tanya Katz) Newsgroups: comp.sys.att Subject: $_ Keywords: ksh csh sh $_ Message-ID: <1083@adds.newyork.NCR.COM> Date: 8 May 89 14:30:26 GMT Organization: Applied Digital Data Systems Lines: 46 In article <704@icus.islp.ny.us> Lenny Tropiano writes: >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 ... The scenario painted in this article, namely stripping the execute permission from /bin/sh by using $_ while running sh.. is something I am quite capable of doing! Ouch! I gather $_ in ksh is supposed to be similar to csh's !$. However it is really quite different. Even the way it is implemented is different. In csh, the command & substitution are echoed before being executed, so you can see the horrible things you are doing, even if you can't quite stop them!! At least if you could see the the argument expanded wrong, you can possibly undo the damage. But, alas there is no expansion, and even when you call up a history the $_ appears as $_, and you have to trace it back to the offending line. Last weekend must have been damage the pc weekend, because I too created havoc by disconnecting the keyboard. I was just supposed to be for a second, the phone rang just as I did this and sent my computer into never-never land. Had to reboot! Ugh! Never, Never, disconnect the keyboard while the coumpter is up! :-( Tanya ------------------------------------------------------------------------------ ### ###### ###### ##### Tanya Katz (516) 231-5400 x430 # # # # # # # # # # # # # ##### ...uunet!ncrlnk!adds!tanya ####### # # # # # tanya.katz@adds.newyork.ncr.com # # ###### ###### ##### Applied Digital Data Systems, Inc. 100 Marcus Blvd., Hauppauge, NY 11788 ------------------------------------------------------------------------------