[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash usage: was implicit linkage



On Sun, 12 Oct 2014 09:33:43 +0100
Martin Read <zen75502@zen.co.uk> wrote:

> On 12/10/14 04:12, Peter Zoeller wrote:
> > But the nice
> > thing is shell scripting is simplistic easy to learn and understand.
> 
> I refer the audience to David A. Wheeler's essay[1] on how to handle 
> filenames correctly in shell scripts, and to the bug report that he 
> filed against POSIX.1-2008[2] on the subject. From those, I take away 
> the lesson that no, shell scripting is not simplistic, easy to learn, 
> and easy to understand. It just *looks* simplistic, easy to learn,
> and easy to understand, in ways that make it a horribly effective
> footgun.
> 
> [1] http://www.dwheeler.com/essays/filenames-in-shell.html

Martin,

Thanks so much for the preceding resource. It's worth its weight in
gold, and I've bookmarked it for quick retrieval.

This essay practically screams out for somebody to write a C program
that takes an argument of an arbitrary string, finds all files in a
directory, and returns a long string with those files separated by the
arbitrary string. A shellscript can then use mktemp or some other
facility to make that arbitrary string, pass it to the C program, and
then use the temporary string as a sure fire field separator. The C
program could also take an option as to whether or not should find
hidden files, and it could prepend "./" onto all relative paths not
already beginning with "./". I might do that tonight.

Thanks for this great info. I wish I'd had it a decade ago.

SteveT

Steve Litt                *  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance


Reply to: