Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15853

Re: Preventing Bash Variable Confusion

From konsolebox <konsolebox@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Preventing Bash Variable Confusion
Date 2020-01-30 16:19 +0800
Message-ID <mailman.93.1580372436.2384.bug-bash@gnu.org> (permalink)
References <20200128210225.GC12574@localhost4.local> <CAJnmqwbr6EVJOZn6SLdByAgZAoFN60ahCp3m2HJyJ6VS=hwEvg@mail.gmail.com> <20200130064018.GA23692@localhost4.local> <CAJnmqwa0y4iOQEzFPZjGGqtJ3eLPPdsZRz2ZAfLneEtQUJo2nA@mail.gmail.com>

Show all headers | View raw


On Thu, Jan 30, 2020 at 2:40 PM Roger <rogerx.oss@gmail.com> 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 could be using for describing my variable or
> function.  (If I were writing unreadable code, I probably would not mind.)

Really just useful if you're writing in multiple scripts.

> 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.

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.

-- 
konsolebox

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Preventing Bash Variable Confusion konsolebox <konsolebox@gmail.com> - 2020-01-30 16:19 +0800

csiph-web