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.


Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.