Hacker News new | ask | show | jobs
by arp242 938 days ago
Related pet peeve: always writing variables as $UPPER_CASE in shell scripts.

Useful: $UPPER_CASE for exported variables ("super globals"), $lower_case for anything else. Can also use $lower_case for function locals and $UPPER_CASE for exported and script global variables (stylistic preference; both are reasonable).

Not useful or reasonable: $ALWAYS_UPPER_CASE_NO_MATTER_WHAT.

I suppose people started doing it because they saw $EXPORTED_VARIABLE and thought "oh, I need to always upper case it", not realizing what that meant. And then after that more copy-copy of this "style".