Bash Bang (!) commands(bash的“!”命令,重新运行前一个命令的全部或部分。)

Re-run all or part of a previous command.

Syntax
      !!       Run the last command again

      !foo     Run the most recent command that starts with 'foo' (e.g. !ls)

      !foo:p   Print out the command that !foo would run
               also add it to the command history

      !$       Run the last word of the previous command (same as Alt + .)

      !$:p     Print out the word that !$ would substitute

      !*       Run the previous command except for the last word

      !*:p     Print out the previous command except for the last word

     ^foo^bar  Run the previous command replacing foo with bar

转载自:https://ss64.com/bash/bang.html

posted @ 2020-07-22 11:33  叶建成  阅读(353)  评论(0编辑  收藏  举报