Repeat last command with “sudo”

后端 未结 5 949
情歌与酒
情歌与酒 2021-02-01 11:58

I often forget to run commands with sudo. I\'m looking for a way to make a bash function (or alias) for repeating the last command with sudo. Something

5条回答
  •  遥遥无期
    2021-02-01 12:31

    You can write:

    sudo !!
    

    (See §9.3 "History Expansion" in the Bash Reference Manual.)

提交回复
热议问题