[ale] Keep space separated values sane in a bash "for" loop?

Robert Story rstory-l at 2006.revelstone.com
Fri Apr 6 12:16:04 EDT 2007


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"



More information about the Ale mailing list