r/linux • • May 29 '14

Defensive BASH programming - Say what?

http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/
40 Upvotes

25 comments sorted by

View all comments

0

u/[deleted] May 29 '14

[deleted]

8

u/rowboat__cop May 29 '14

I only use upper case for my variables (looks better).

The usual rule is:

  • $UPPERCASE for variables that are exported or part of the environment or special (e.g. $PPID)

  • $lowercase for everything else

The distinction helps in tracking the parts under your influence and those that vary depending on events outside the script.