$_

Tanya Katz tanya at adds.newyork.NCR.COM
Tue May 9 00:30:26 AEST 1989



In article  <704 at 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 at adds.newyork.ncr.com
  #     # ######  ######   #####       

  Applied Digital Data Systems, Inc.   100 Marcus Blvd., Hauppauge, NY 11788 
------------------------------------------------------------------------------



More information about the Comp.sys.att mailing list