2
How can I create an alias named -
in Bash? None of the following works:
alias -='cd -'
alias \-='cd -'
alias '-'='cd -'
with error:
bash: alias: -=: invalid option
alias: usage: alias [-p] [name[=value] ... ]
2
How can I create an alias named -
in Bash? None of the following works:
alias -='cd -'
alias \-='cd -'
alias '-'='cd -'
with error:
bash: alias: -=: invalid option
alias: usage: alias [-p] [name[=value] ... ]
6
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 -
.
Wow, that was quick. Thanks a bunch. Seems to work like a charm. – 0xC0000022L – 2012-02-06T17:21:32.697