fish: sudo: !!: command not found
I haven't found a inbuilt replacement for !!
in Fish however you can write a function that allows you to keep using !!
Taken from this answer https://superuser.com/a/719538/226822
function sudo --description "Replacement for Bash 'sudo !!' command to run last command using sudo."
if test "$argv" = !!
eval command sudo $history[1]
else
command sudo $argv
end
end
The !!
syntax is part of the bash history substitution feature, which fish does not implement. See this link for a discussion. Please feel free to weigh in there on what you think fish ought to do.
The most efficient (in terms of keypresses) replacement for sudo !!
is up-arrow to recall the last history item, ctrl-A to move to the beginning of the line, then type sudo.