In a series of bash quicksand blog entries, I hope to post some warning signs about what to avoid.
I want to write them down because after one gets used to bash syntax, one tends to forget about the initial hurdles. Hopefully, no late comers will be trapped in bash quicksand.
Let's begin.
Say you want to assign the text string myvalue to some variable myvariable. What is more simple than that?
$ myvariable = myvalue
bash: myvariable: command not found
$
Oops. And you vowed that it worked before.
What transpired was that bash attempts to execute the command myvariable with the arguments = and myvalue.
Proper syntax requires no whitespace before and after the equal sign:
$ myvariable=myvalue
$ echo $myvariable
myvalue
$
0 comments:
Post a Comment