To forget about this, I define the following at the top of my .bashrc , as well as for each of my Bash shell script files:
The above definitions allow me to say, for example:
def foo { echo bar; } def foo { echo bar; } .final foovar foo=barval foo=bar
As indicated in the comments, you can mix and match various variable flags, such as var -g foo=bar for the global (-g) variable (var) or val -Ai foobar=([foo]=0 [bar]=1) for read-only (val), associative array (-A), consisting of integer (-i) values.
Implicit redefinition of variables is also implied. Also, the new familiar keywords def , val , var and final should be familiar to any programmer who programs in languages ββsuch as JavaScript, Java, Scala, etc.
source share