Variable assignment in sh

Polytropon freebsd at edvax.de
Sat Feb 4 04:03:47 UTC 2017


On Fri, 03 Feb 2017 22:48:49 -0500, Garance A Drosehn wrote:
> On 3 Feb 2017, at 17:25, James B. Byrne wrote:
> 
> > On Wed, February 1, 2017 19:21, Garance A Drosehn wrote:
> >
> >>
> >> On something of minor tangent, if you're writing scripts in
> >> either 'sh' or 'bash', you may find the following web site
> >> helpful:         http://www.shellcheck.net
> >
> >
> > I just wish to clarify something here.  What I am doing is attempting
> > to reuse a one-liner that has one conditional in it.  I do not
> > consider that to be scripting or programming.  I am just piping
> > a few tools together and checking if anything comes out the end.
> 
> Understood, but even those trivial one-liner tasks might be improved
> by pasting them into shellcheck.  I've had shellcheck point out things
> I'm doing which "almost always" work, but will fail depending on the
> filenames my one-liner happens to be working on.

In this case, the follwing articles might be helpful in the future:



David A. Wheeler:

Filenames and Pathnames in Shell: How to do it Correctly

https://www.dwheeler.com/essays/filenames-in-shell.html



And:



David A. Wheeler:

Fixing Unix/Linux/POSIX Filenames:
Control Characters (such as Newline), Leading Dashes, and Other Problems

https://www.dwheeler.com/essays/fixing-unix-linux-filenames.html




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list