> On Thu, Sep 01, 2011 at 09:35:14AM +0300, Angel Tsankov wrote: >Hello, > >The Bash Reference Manual >(http://www.gnu.org/s/bash/manual/bash.html#Special-Parameters) says: > >At shell startup, [$_ is] set to the absolute pathname used to invoke >the shell or shell script being executed as passed in the environment or >argument list. [...] > >However, with GNU bash, version 3.2.39 a simple script (named 'a'): > >#!/bin/bash >echo "$_" > >prints './a' when invoked as './a'. According to the above excerpt, >should it not print an absolute path to 'a' instead?
bash-4.2_p10, seems to print to stdout the last file, folder or command. MAILPATH A colon-separated list of file names to be checked for mail. The message to be printed when mail arrives in a particular file may be specified by separating the file name from the message with a `?'. When used in the text of the message, $_ expands to the name of the current mailfile. Example: MAILPATH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"' bash-4.2_p10 doesn't say much more about $_. Learning the Bash Shell 3rd version just paraphrases the above. Thought I saw something more written about the $_ someplace, guess not though. -- Roger http://rogerx.freeshell.org/