Using bash history to get a previous command, copy it and then 'run' it but with the command commented

后端 未结 10 1041
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 20:34

Just a question to improve my bash skills. I always do this:

$ history | grep some_long_command

...
...
123 some_long_command1.........
124 some_l         


        
10条回答
  •  感情败类
    2021-01-29 20:56

    You can get to edit mode by hitting M-^ (option-shift-6 on a mac).

    Type this:

    !123M-^

    And you'll be editing command #123. It's sort of like using ctrl-r, but starting with exclamation-point syntax.

提交回复
热议问题