I'd like the create the alias -- for the bash cd - command. Searching to solve this problem, I found the advice to use this alias:
alias -- -="cd -"
However, that leads to the following error, as seen in this session snippet:
chris@DeathStar:~$ cd .vim
chris@DeathStar:~/.vim$ --
-bash: --: command not found
chris@DeathStar:~/.vim$
My bash --version:
GNU bash, version 4.2.39(2)-release (i386-apple-darwin12.2.1)
Copyright (C) 2011 Free Software Foundation, Inc.
Any ideas?
The alias you created seems to be -, not --. If you want it to be --, you need to declare it as:
alias -- --="cd -"
You can always check the list of declared aliases in your shell session, by simply typing alias.
P.S.
The first -- sequence following the alias has nothing to do with the alias name, it's just needed in order for the alias command to not consider following parameters starting with a - as command options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With