Bash alias -=... (alias name should be a simple dash) not working

I intend to create an alias for cd - which need to be simply a dashboard (-). I attempted without success:

alias -='cd -'     # bash: alias: -=: Invalid option
alias \-='cd -'    # bash: alias: -=: Invalid option
alias '-'='cd -'   # bash: alias: -=: Invalid option
alias '\-'='cd -'  # bash: alias: `\-': Invalid alias name.

The previous 3 coincide (just various input, yet bash transforms every one of them right into the very same command alias with a solitary argument -=cd -), so it is not a surprise the mistake message coincides. I would certainly presume that if the argument begins with a dashboard, it is analyzed as a flag as opposed to the alias name.

Is it also feasible to make use of - as an alias name?

16
2022-07-25 17:38:08
Source Share
Answers: 0