> On Thu, Jan 30, 2020 at 11:37:26AM +0800, konsolebox wrote: > > Here's my take. > You can still use all caps on global variables just mind the internal > variables. You can have it prefixed by an underscore if you worry about > conflicts.** You can also have it prefixed with the script's name in all > caps.** It's best to have the variables initialized at the beginning if > the script so it's explicit that you intend to use the variables as global > variables of the script. > And then you use lowercase on local.** Use an underscore or > two-underscores prefix on indirect variables and never reference an > indirect variable with another.** This includes passing the indirect > variable for reference to another function. > -- > konsolebox
I've thought about this, yes I can use that style. However... 1) Using an underslash on all capitol variable names just looks ugly in my opinion. Or more to the point, the style seems to stray away from main stream styles. 2) Prefixing variable names with the name of the script (or other lengthy prefix) requires more characters I could be using for describing my variable or function. (If I were writing unreadable code, I probably would not mind.) I've decided to comply with Google's Style guidelines, even though they do not pay me a paycheck, but they do give me lots of free stuff. Shrugs, besides, the more my Bash scripting looks like C, the easier it is to read. The can push me away from defining my variables in all capitol letters. They can even push me to code in C and Assembly, but just don't push me to script in Python. -- Roger http://rogerx.sdf.org/