[Gllug] spaces and shell scripting
Liam Smit
liam.smit at gmail.com
Thu Sep 1 13:56:16 UTC 2005
Hi Jon
> I'm trying to write a shell (bash) script that uses find to get a list
> of file names and do different things depending on whether there are 0,
> 1 or more items in the list.
>
> My problem is spaces in filenames and how to deal with them when I have
> a list of file names in a variable. I got the script to work by running
> find multiple times and not using variables, e.g.
Why put a list of file names in a variable?
It sounds like each filename should be in it's own variable.
> FILE_COUNT="find /some/directory -print | wc | cut -c 1"
Perhaps use wc -l to count lines, just put each file name on a new line?
Cheers
Liam
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list