When I type sudo!! it never puts a space between sudo and anything. How do I make sudo!! add a space?
Example:
nano text.txt
sudo!!
sudonano text.txt
Maybe I am using it wrong but it never works unless I add a space after sudo.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityYou need to use
sudo !!
instead of sudo!!
. This is intended behaviour. The !!
history expansion, as stated in the documentation:
designates the preceding command. When you type this, the preceding command is repeated in toto.
It is simply as if !!
were replaced with a find/replace with the contents of the last line. Naturally, since your line didn't start with a space, a space isn't included in the expansion.