Answers:
在bash中,“上一个命令行中的最后一个单词”的指示符是!!$:
$ echo hello world
hello world
$ echo goodbye !!$
echo goodbye world # this is bash echoing actual cmd line before execution
goodbye world
您还可以使用“插入符号语法”替换命令行的初始部分;如果要在同一文件上执行多个命令,这将很方便:
file file.dat
^file^ls -l^ #gives `ls -l file.dat`
^ls -l^stat # gives `stat file.dat`
还有更多的可能性。有关详细信息,请参见bash(1)手册页中的“历史记录替换” 。
!!$可写!$了。