Rerun previous command under sudo

view full story

http://askubuntu.com – I want to be able to run a command, it fails cause it doesn't have proper permissions. Then I can write "please" to sudo the command I just ran. Here's what I want to do in the terminal: $ run command "you don't have access to do that" $ please "ran successfully" I saw that !! will grab the previous command, so I thought I could use that, but I can't get it to work. my please.sh shell script looks like this, but I can't get any of these to work. It just says "command not found !!" and prints out the sudo usage. #!/bin/zsh #sudo !! #sudo `!!` sudo $(!!) (HowTos)