[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Keep space separated values sane in a bash "for" loop?
On Fri, 06 Apr 2007 01:53:41 -0400 Jim wrote:
JP> Perhaps I missed something from earlier in this thread, but why won't
JP> this work for you:
JP>
JP> #!/bin/bash
JP> export oldifs=$IFS
JP> export IFS="$"
JP> for i in `ls`; do echo $i; done
JP> export IFS=$oldifs
I tried it and it looks like it works, until you change
echo $i
to
echo \"$i\"
Then I see:
"File1
File 2
File3"