How to use arguments from previous command?

前端 未结 11 1780
一个人的身影
一个人的身影 2020-12-04 04:35

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

11条回答
  •  一向
    一向 (楼主)
    2020-12-04 04:48

    You can also get arguments from any command in your history!

    
    $ echo a b c d e f g
    a b c d e f g
    $ echo build/libs/jenkins-utils-all-0.1.jar
    build/libs/jenkins-utils-all-0.1.jar
    $ history | tail -5
      601  echo build/libs/jenkins-utils-all-0.1.jar
      602  history | tail -10
      603  echo a b c d e f g
      604  echo build/libs/jenkins-utils-all-0.1.jar
      605  history | tail -5
    $ echo !-3:4
    echo d
    d
    $ echo !604:1
    echo build/libs/jenkins-utils-all-0.1.jar
    build/libs/jenkins-utils-all-0.1.jar
    

提交回复
热议问题