On 08/05/2006 12:45 AM, John O'Hagan wrote:
Hi, I keep running into this particular gap in my scripting, and hope someone can clear it up for me.
FILES=$( ls SOMEWHERE )  #or find or grep, etc

for FILE in $FILES; do SOMETHING; done

I often find that if there are spaces in the names of anything in $FILES, the execution of SOMETHING occurs separately for each word in the name, producing unexpected results.

Quoting doesn't seem to help. Are there ways to deal with this?


Yes,

while read FILE
do
   echo play with $FILE
done <<< "$(ls)"

Thanks,

John



You're welcome.



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to