I often forget to run a command with sudo, so I find myself often typing sudo !!
immediately afterwards.
I tried aliasing this, but bash chokes on the !!
part. Is there some way to represent this shortcut within an alias?
aliasbashbash-aliassudo
I often forget to run a command with sudo, so I find myself often typing sudo !!
immediately afterwards.
I tried aliasing this, but bash chokes on the !!
part. Is there some way to represent this shortcut within an alias?
Best Answer
AIUI the problem is that history substitutions (
!!
) are done before alias substitution. I haven't tested this thoroughly, but it looks likefc
can be used to get what you want: