I want to define the =
equals sign as a Bash alias but Bash does not allow any of the following definitions:
alias =='echo foo'
alias \=='echo foo'
alias -- =='echo foo'
alias -- \=='echo foo'
Does someone know a notation that works?
This is one of the reserved special chars, used for assignment and test and you cannot use it for alias. More info: http://tldp.org/LDP/abs/html/varassignment.html#EQREF
Use a function:
=() { echo "foo"; }
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