Meaning/usage of $_ in bash

Thomas Charron twaffle at gmail.com
Wed Jul 23 13:21:56 EDT 2008


On Wed, Jul 23, 2008 at 12:57 PM, Michael ODonnell
<michael.odonnell at comcast.net> wrote:
> This is just a nit but I've never understood the meaning/usage
> of the $_ variable in bash.  I did RTFM and it says:
>  "When bash invokes an external command, the variable $_ is set to
>  the full file name of the command and passed to that command in its
>  environment."
> ...which seems to describe one piece of how it actually works in one
> situation.  For example, if I create and execute a shell script thus:

  I had always known the $_ to contain the last paramater of the last
command.  Param lists include the exe, so no param, last param = the
exe.

-- 
-- Thomas


More information about the gnhlug-discuss mailing list