On Tue, 18 Feb 2003, Theo. Sean Schulze wrote: > Thanks, that did help, although it didn't solve the problem. > I now recognize that the problem is in assigning the variable. > Both my version with ls and the version with find in the example give > the expected results when printing to the console, > but they both fail when used to assign a string including spaces to a > variable. I need to find a way to maintain the integrity of the string > as I assign it to the file variable. I tried `echo (ls -1)` and `echo > "(ls -1)"`, but neither works. Changing the parentheses to brackets > doesn't help either. > > Cheers, > Sean
Assigning variables does not happen in the `ls -1' statement. This only generates strings. You need a command that read's the variables correctly. Use `read', as in: ls -1 | while read file ; do echo "$file" ; done or find . -type f | while read file ; do echo "$file" done or more exotic, array version. IFS=$'\n' eval 'lines=( $(cat < $file) )' # now you have a array of lines.... which can be proccessed further.. These all where tested and work just fine. G00d lUcK J. - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs