Friday, July 9, 2010

best practices in shell script programming

You do know the result of this:
a=A; echo $a
But are you just as sure here?

a=A; b=B; echo $a.$b
That depends on the shell, you are using. So I suggest you better write it this way:


a=A; b=B; echo ${a}.${b}
Enclosing variable names in curly braces is quite often a good idea.

No comments: