problems using ls with for_in (SH)
Robert Huff
roberthuff at rcn.com
Thu Nov 8 19:29:30 PST 2007
=?ISO-8859-1?Q?Sd=E4vtaker?= writes:
> Im trying to get a file with all the md5 hashes of one directory.
> My initial script was this:
> #!/bin/sh
> for file in $(ls)
> do
> echo $file
> md5 $file
> done
>
> The problem is with the file names who contains "whitespaces" becouse
> the for_in passed each word as one iteration and not the full filename,
> I'd tried using -B in ls, but doesnt help.
> Any idea what can i do?
Yes. :-)
Find the documetation, and look up the IFS environment
variable.
Robert Huff
More information about the freebsd-questions
mailing list