3

In Bash, the positional parameter $_ holds the last argument in the previous command:

$ /home/joe> some-script foo bar
$ /home/joe> cd $_
$ /home/joe/bar> 

The positional parameter $_ does not seem to work in the fish shell.

Is there some way in the fish shell using which I can get the last argument in the previous command? This can be useful in cases where that argument is a really long path, which can be painful to type again.

1 Answers1

5

fish uses $_ for the currently running program: http://fishshell.com/docs/current/index.html#title

To get the last arg of the last command, use Alt+Up

glenn jackman
  • 27,524