I decided to use following convention for variables in my Bash scripts:
A) Variables are written without curly brackets if:
- They are fine to be set via environment, e.g.
$HOME - The environment doesn't play a role, e.g.
$OPTARGwhose value is set bygetopts
B) All other variables are written with curly brackets, e.g.: ${KERNEL_VERSION}
Variables that fall under scenario B) are unset at the beginning of the Bash script.