Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Roger Newsgroups: gnu.bash.bug Subject: Re: Preventing Bash Variable Confusion Date: Wed, 29 Jan 2020 13:05:11 -0500 Lines: 71 Approved: bug-bash@gnu.org Message-ID: References: <20200128210225.GC12574@localhost4.local> <20806.1580277461@jinx.noi.kre.to> <20200129142305.GX1350@eeg.ccf.org> <20200129180511.GA5533@localhost4.local> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uAKRQypu60I7Lcqm" X-Trace: usenet.stanford.edu 1580321118 16865 209.51.188.17 (29 Jan 2020 18:05:18 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CDVkPlLuvk67Tcr2XnGl+hfE5sFKa/n1pNX5sqpfM6A=; b=RQ2U0DpiOatYZ1BKuFF3mlwlPreaXwImPIovU7cfnJ9P6jlKo5WSP7OIDIEydiZ96k 85GAbupbQeUdU3Zxk/VlrElNdhRyZDlmu0q7p/eduAbNkJ8S9W5Gep2OuDrqgFL97BO6 v7qFcS+L1nF9XP1fDBbw9AQP3xC5HmajzrWo5n+eCJBXeoC95cE11Pi9MMocDDN9ohu9 QTumLthtVvz6ogZDD2Qy6kMTJpFGpgh5CPptwi2w1Bavza6lYvAnyMRE2dGe8ljQo5zA VdVz0VKt87oc4iCaTnMiMBUBvN4Y/ei0vjjh0UQUF8iEDv4OyV2PmINQVKVMbJRzZOqL dMVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CDVkPlLuvk67Tcr2XnGl+hfE5sFKa/n1pNX5sqpfM6A=; b=jVkpCB4W09jIjHs6uY4/bjdTI/QCxDBb9pDThFD55r85/jjSVmvHBg0PJv8qfimkJt zjIwQ2Ua6OnmhKkqURKbu69KBQXQa1Eb5cF73l07BCsagDjDDBQBTDmqZcPTylcNWwLp QKXpjdliV87KGPJzMz9nflm2etU9jnk8pRS05zNNcprjPMTyelO5UKyqD5VYcoqAmozN VLtEse4g6R9AMlJWNGHMVtkklSOUnbcLMKkpQCU5+oMVGOHROeFGAxYii0+a1YqAUv6S B7MMYchrdnVkwAChi0yBZZBfpkJpqSbknljoQ59GznG+e02sCnR2erCxcjtsZNel7p9K cXzA== X-Gm-Message-State: APjAAAUuJ2rvS1M0qamiLQ+CXVF+fALhByvyChmkupHMqmKLBpZbMWSq +0FlaAR+6scE1a40mx0mDdZxn53KabI= X-Google-Smtp-Source: APXvYqzWHLm+ywLd99ZLu5f53kmSwvTBXPyC6s6GxIbj1VG795QMkIyIKWjDuueY84tV8wX6BkhLEA== X-Received: by 2002:a37:a30a:: with SMTP id m10mr967708qke.56.1580321113275; Wed, 29 Jan 2020 10:05:13 -0800 (PST) Content-Disposition: inline In-Reply-To: <20200129142305.GX1350@eeg.ccf.org> X-PGP-Key: http://rogerx.sdf.org/about/armor-F515AC1F231FFC4EF0BCDE7606CEA0ECE2887C75-20170104.asc User-Agent: Mutt/1.10.1 (2018-07-13) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::72f X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20200129180511.GA5533@localhost4.local> X-Mailman-Original-References: <20200128210225.GC12574@localhost4.local> <20806.1580277461@jinx.noi.kre.to> <20200129142305.GX1350@eeg.ccf.org> Xref: csiph.com gnu.bash.bug:15842 --uAKRQypu60I7Lcqm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Awesome. So $mVARIABLE is an alternative. However, per Google style and my preferen= ce,=20 mixed seems messy. I thought camel/mixed case increased readability years = ago,=20 but over time I typed my_variable or my_function_name (C code) much easier = as=20 well as read easier. The missing space char between words seems to condone= =20 confusion when attempting to read script/code naturally. All capitol case= =20 variable names were extremely visible when reading code, but seems now to b= e=20 explicitly reserved for OS intercommunication use. I think I prefer the style; $_variable, $my_variable and f_functionname. = =20 Google style documentation cited the "$_" prefix satisfied uniqueness from = OS=20 related variable names as well as supposedly increasing readability or=20 distinguishing variables from the rest of the scripting language. Also the use of local defined variables within functions is probably desira= ble. =20 I'll start incorporating these techniques within my scripts as well as like= ly=20 incorporating a trap protection within loops calling non-builtin commands. For reference: Google Shell Style Guide https://google.github.io/styleguide/shell.xml Ky-Anh Huynh icy (Popular Hit) https://github.com/icy/bash-coding-style Seems to be a duplicate of Google's style guide. --=20 Roger http://rogerx.sdf.org/ --uAKRQypu60I7Lcqm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE9RWsHyMf/E7wvN52Bs6g7OKIfHUFAl4xyVMACgkQBs6g7OKI fHUXOggAgtb4mEfH6bJdY92P3Kq/9V5acCvbo9/qoMxmCnonU2EephhYiLPYy3JK ZWDieuT368/he+YQh0oJXuj4oiE/mQ4T3ePJLp7yKrdxWAQWAK7eMj3mJU3wkhka xmmdgwrjKeDfaa+TTx//wx7rHtiRBRuzanEHhJcSaWxGZwmUj9URfc8NvRH/cv9l SN+sUnGxg+cM1k/B4BFLsNrHJw0zdUevwcePsM8InKXkoqoTdDOZe33i9nQfOlBI Bu9Ae+HIhUBcjzN6hPd4VUSsniET3794zezAjYNCR5y705T5PaiCV7Tf7zlu89pv k1+wwhCHdsHTNb9qdS6dMtwFkRlzVA== =JnjE -----END PGP SIGNATURE----- --uAKRQypu60I7Lcqm--