【问题标题】:simple way of substitute last arg using history cmd使用历史命令替换最后一个参数的简单方法
【发布时间】:2016-01-03 13:45:22
【问题描述】:

例如,

/usr/local/apache2/bin/apachectl args1 args2 args3 restart

/usr/local/apache2/bin/apachectl args1 args2 args3 stop

我能想到的是!!:2-4 stop,但是这需要显式计算索引,有没有更好的解决方案?

【问题讨论】:

    标签: bash history


    【解决方案1】:

    这似乎足够了

    !!:- stop
    

    !!:2- 获取从第二个参数开始的所有参数(除了 最后一个参数)。

    (link)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-15
      • 1970-01-01
      • 2017-12-13
      • 2015-03-11
      • 1970-01-01
      相关资源
      最近更新 更多