Until Recently I had
alias sudo='sudo ' in my
.zshrc file. Today I ran into this error on trying to do
➜ ~ sudo mv nginx.conf.orig nginx.conf.orig2 sudo: nocorrect: command not found
Now googling around I found out that this seemed to be to do with some commands that are prefixed with
nocorrect and that I could fix this with
alias sudo='nocorrect sudo'.
However the problem comes when I try to set my alias to
alias sudo='nocorrect sudo ' to allow myself to use additional aliases. I also ensured that my su was using zsh as mentioned here.
➜ ~ alias sudo='nocorrect sudo ' ➜ ~ sudo mv nginx.conf.orig nginx.conf.orig2 sudo: nocorrect: command not found ➜ ~ alias sudo='nocorrect sudo' ➜ ~ sudo mv nginx.conf.orig nginx.conf.orig2 ➜ ~ su Password: michaelarch# ps -p $$ PID TTY TIME CMD 25831 pts/1 00:00:00 zsh
Does anyone have any suggestions on how to resolve this?
alias sudo='sudo ' allows you to use aliases with your sudo commands, for an example see below.
➜ ~ alias cat='echo hello' ➜ ~ echo goodbye > example.txt ➜ ~ cat example.txt hello example.txt ➜ ~ sudo cat example.txt goodbye ➜ ~ alias sudo='sudo ' ➜ ~ sudo cat example.txt hello example.txt
For some more info on my shell:
➜ ~ sudo chsh Changing shell for root. New shell [/usr/bin/zsh]: ➜ ~ unalias sudo; alias sudo='nocorrect sudo ' ➜ ~ echo $SHELL; which sudo /usr/bin/zsh sudo: aliased to nocorrect sudo ➜ ~ sudo mv nginx.conf.orig2 nginx.conf.orig sudo: nocorrect: command not found ➜ ~ which mv mv: aliased to nocorrect mv