HiveMinds / Productivity-setup

Automatically sets up a productivity setup on Ubuntu 20.04 OS.
GNU Affero General Public License v3.0
2 stars 4 forks source link

Improve variable capitalisation of bash scripts. #6

Open a-t-0 opened 3 years ago

a-t-0 commented 3 years ago
      <p>Use <a rel="nofollow" href="https://stackoverflow.com/questions/673055/correct-bash-and-shell-script-variable-capitalization">https://stackoverflow.com/questions/673055/correct-bash-and-shell-script-variable-capitalization</a> as a reference.<br>

A few things are important here:

So theoretically an issue could be that one "accidentally overwrites" the list of bash default variables (either with a exported value or a constant). To prevent this you could add a prefix to minimise the odds of accidentlly naming your exported variable/constant the same as a bash default variable. For example instead of writing OUTPUT_FILEPATH, one could add prefix LOG_ to write: LOG_OUTPUT_FILEPATH.