2

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.

Ashwin Nanjappa
  • 9,947
  • 26
  • 79
  • 110

1 Answers1

3

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
  • 25,463
  • 6
  • 46
  • 69