Skip to main content
Notice removed Reward existing answer by Adam Smith
Bounty Ended with nonopolarity's answer chosen by Adam Smith
Notice added Reward existing answer by Adam Smith
Bounty Started worth 100 reputation by Adam Smith
formatting, punctuation, grammar
Source Link
Matthias Braun
  • 33.5k
  • 26
  • 150
  • 175

I know that ESC DOTEsc + . gives you the last argument of the last command.

But I'm interested in first argument of the last command. Is there a key binding to do so?

On the same lines, is there a generic way of getting the nth argument from the last command.? (I know that in a bash script, you can use $0$0, $1$1 etc., but these don't work on the commandline).

Also, what about iterating through the 0th argument of previous commands, like we can do with the last argument by continuously pressing ESC DOTEsc + .?

I know that ESC DOT gives you the last argument of the last command.

But I'm interested in first argument of the last command. Is there a key binding to do so?

On the same lines, is there a generic way of getting nth argument from last command. (I know that in a bash script you can use $0, $1 etc., but these don't work on commandline)

Also, what about iterating through 0th argument of previous commands, like we can do with last argument by continuously pressing ESC DOT

I know that Esc + . gives you the last argument of the last command.

But I'm interested in first argument of the last command. Is there a key binding to do so?

On the same lines, is there a generic way of getting the nth argument from the last command? I know that in a bash script, you can use $0, $1 etc., but these don't work on the commandline.

Also, what about iterating through the 0th argument of previous commands, like we can do with the last argument by continuously pressing Esc + .?

BASH - How to use arguments from previous command?

edited title
Link
Aman Jain
  • 11.2k
  • 15
  • 52
  • 63

bash BASH - first argument of theHow to use arguments from previous command?

added 2 characters in body
Source Link
Aman Jain
  • 11.2k
  • 15
  • 52
  • 63
Loading
added 138 characters in body; added 4 characters in body
Source Link
Aman Jain
  • 11.2k
  • 15
  • 52
  • 63
Loading
edited tags
Link
Fred Foo
  • 361k
  • 78
  • 752
  • 843
Loading
Source Link
Aman Jain
  • 11.2k
  • 15
  • 52
  • 63
Loading