I'm using zsh
with oh-my-zsh
. I'm trying something very simple:
alias fu='sudo !!'
So, if I issued a command that needed a forgotten sudo
I could quickly re-do it.
Yes, I googled for that and I even saw several examples but NONE worked for me. For example:
ls
bla bla
!!
zsh: command not found: !!
I also tried:
ls
bla bla
fc -e : -1
bla bla
# that worked! But let's see with sudo...
ls
bla bla
sudo fc -e : -1
# nothing happens!
Another:
alias redo='sudo $(history -p !!)'
# didn't work
I've tried in Mac and Ubuntu, same issues.