I am using the command line in a MacBookPro terminal, with zsh as the default profile.
I am trying to write a global alias to the zshrc in my home directory file but encounter a strange error.
If I write the alias text using NANO the file saves the new alias, however if I write the following in the command line, the zshrc file does not updates to include the new alias.
MWE:
alias -g c="clear"
source ~/.zshrcAny ideas on how to discover the problem?
1 Answer
Global aliases in Zsh are so aggressive that you’re replacing even the c in ~/.zshrc. Your
source ~/.zshrcis interpreted as
source ~/.zshrclearYou probably want a simple alias instead of a global alias. Try this instead:
alias c='clear'