Mail archive

Re: [alpine-devel] Shell scripting guidelines

From: <>
Date: Sat, 5 Nov 2016 21:10:26 +0100

Oh by the way

On Sat, Nov 05, 2016 at 03:06:28PM -0400, Gemsbokella wrote:
> * We don’t usually use curly braces around variables if they are not needed.

It is prudent to always put quotation marks around variable substitutions
(like, no $ outside "").

Even if you know with certainty that the value can not contain white
space because of how the script is written _now_, you may sometimes have
got it wrong.

Then later someone can rewrite parts of the script without being aware
of this assumed constraint (unless you document the assumption? which
probably takes more effort than adding "").

There are cases where a substitution is _meant_ to yield several words,
this is of course a different situation and a useful hack, given
the limited array handling facilities in Bourne sh.


Received on Sat Nov 05 2016 - 21:10:26 UTC