reusing last command argument
1
$ echo 1
2
1
3
$ echo 2
4
2
5
$ echo 3
6
3
7
$ echo 4
8
4
9
$ echo 5
10
5
Copied!
use alt + . will reuse the last program argument in descending order
1
$ echo (press alt + .)
2
$ echo 5 (press alt + . again)
3
$ echo 4 (press alt + . again)
4
...
Copied!

selective arguments

  • !:1 gives you the first argument
  • !:2-3 gives you 2nd and third argument and
  • !:-3 gives you binary name + first 3 arguments
1
$ echo 1 2 3 4 5
2
$ echo !:1 # -> echo 1
3
$ echo 1 2 3 4 5
4
$ echo !:2-3 # -> echo 2 3
5
$ echo 1 2 3 4 5
6
$ echo !:-3 # -> echo echo 1 2 3
Copied!
Last modified 1mo ago
Copy link