Re: Preventing Bash Variable Confusion

2020-01-30 Thread Chris F.A. Johnson
On Thu, 30 Jan 2020, Roger wrote: They still allow you to define constants in all-caps. The impact it makes is not so different with defining globals as such. Try Ruby. The reason I used to prefer using all uppercase/capital letters, the variable definitations would stand out similar to C st

Re: Preventing Bash Variable Confusion

2020-01-30 Thread Roger
>They still allow you to define constants in all-caps. The impact it >makes is not so different with defining globals as such. Try Ruby. The reason I used to prefer using all uppercase/capital letters, the variable definitations would stand out similar to C style definition macros. Variables

Re: Preventing Bash Variable Confusion

2020-01-30 Thread Chris F.A. Johnson
On Wed, 29 Jan 2020, Chet Ramey wrote: On 1/29/20 2:05 PM, Roger wrote: "Linux Shell Scripting with Bash." (Burtch) suggested using declare instead of local, due to local lacking the other switches declare provides. p262 (eg. declare can specify type of variable, such as integar only.) This

Re: Preventing Bash Variable Confusion

2020-01-30 Thread Greg Wooledge
On Thu, Jan 30, 2020 at 11:37:26AM +0800, konsolebox wrote: > You can still use all caps on global variables just mind the internal > variables. Easier said than done. How many times have you had to diagnose someone's failing script, and it turned out the reason it was failing was because they us

Re: Preventing Bash Variable Confusion

2020-01-30 Thread Robert Elz
Date:Wed, 29 Jan 2020 13:57:48 -0500 From:Greg Wooledge Message-ID: <20200129185748.gf1...@eeg.ccf.org> | A script is supposed to be a self-contained entity, as much as possible. | It isn't supposed to be part of some web of tangled dependencies. In general I agr

Re: Preventing Bash Variable Confusion

2020-01-30 Thread konsolebox
On Thu, Jan 30, 2020 at 2:40 PM Roger wrote: > 1) Using an underslash on all capitol variable names just looks ugly in my > opinion. If you mean adding an underscore prefix I agree. > 2) Prefixing variable names with the name of the script (or other lengthy > prefix) requires more characters I c