Repeat last command with “sudo”

后端 未结 5 960
情歌与酒
情歌与酒 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:42

    Not enough?

    sudo !!
    

    if you want the S simply put:

    alias S=sudo
    

    and use it

    S !!
    

    the !! mean the last command

提交回复
热议问题