Sunday, May 10, 2009

bash - last argument of the previous command (nth argument)

  • Get the last argument of the previous command : !!$
  • Get the first argumnet of the previous command : !!^
  • Get the 1st argument of the previous command : !!1
  • Get the nth argument of the previous command : !!n

Examples : 

$> ls :!!$  (or !$) 

$> ls :!!^

$> ls :!!2

$> ls :!!n

No comments: