How can I create an alias named - in Bash? None of the following works:
alias -='cd -'
alias \-='cd -'
alias '-'='cd -'
bash: alias: -=: invalid option
alias: usage: alias [-p] [name[=value] ... ]
Use the following:
alias -- -='cd -'
-- is often used (especially with Gnu programs) to stop parsing the following arguments as options. That's also how you can e.g. rm files whose names start with -.
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
4 years ago