31
18
In bash, you can use !*
to get all the arguments from the previous command. As an example, if you did cp /some/path /some/other/path
and then did mv !*
, the second command would be expanded to mv /some/path /some/other/path
.
Is there anything like this that can be used to access a specific argument from a command instead of all of them?
1I tried it myself and this didn't work, however. After looking at the post by Michale Mrozek, it says to use
!:1
,!:2
. After using the version with the colons, it worked. – Wuffers – 2010-11-14T23:41:00.003@MrMan: Oops, right, if you leave off the colon with a number, the number is interpreted as a line number. Sorry about that. – Gilles 'SO- stop being evil' – 2010-11-15T18:57:24.030
No problem. So, then I assume that doing
!1:1
would point to the first argument of the first line? – Wuffers – 2010-11-17T02:00:19.533