[Gllug] Re: spaces and shell scripting
Jon Dye
jon at pecorous.co.uk
Thu Sep 1 14:51:41 UTC 2005
Tethys wrote:
> Jon Dye writes:
>>I'm trying to write a shell (bash) script
>
> Try and avoid writing bash scripts. Unless you really need a bash
> specific feature, write a generic bourne shell script (or korn shell
> if you need more than /bin/sh provides).
I nearly wrote that I was writing a sh script because I usually try and
do what you suggest, not really sure why I wrote bash in the end!
>>but I want to avoid multiple find statements because they are slow. I
>>guess I want either to put the list of files in a variable with
>>delimiters between the file names or put them into an array somehow.
>
> Put the output of the find command into a temporary file, and work
> on it there. This will handle files containing whitespace and other
> metacharacters, provided you don't have filenames containing newlines[1].
That's solved it, thanks.
JD
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list