For example:
~ echo foo bar baz
foo bar baz
~ echo catz ratz batz
catz ratz batz
~ echo !!:2 #=> ratz
In this case the !!:2
accesses the second argument of the last command. Is it possible to get the second argument of the second to last command which in this case would expand to bar
?
As illustrated by @Jahid in a previous post:
Second argument of the second to last command:
!-n
expands to the command that was 'n' number of commands before the current command.Note:
!-1
and!!
are the same