Steven R. wrote:
On Tue, Aug 07, 2007 at 04:03:05PM -0700, Andrew Sackville-West wrote:So what's the right way to do this? I hacked one together the other day:IFS=$'\t\n'; for i in `find . -iname \*m4a`; do faad... blah blah blah and I knew it was a hack because setting $IFS just seems bad... possible unintended consquences, but it worked.I have seen something like the following: find | while read FILE; do echo "$FILE" done
I missed the original postings (on vacation;). But, regarding IFS, a couple of notes:
1. In "The UNIX Programming Environment", Kernighan and Pike, this variable is used without any caveats, in several of the example scripts.
2. In all cases, the idiom used is: ifs=$IFS IFS='....' # whatever you need for your particular problem. ... # your code IFS=$ifs ... # any other processing that needs to be doneThis guarantees that the original value, whatever it is, is restored and used for "normal" processing.
-- Bob McGowan
smime.p7s
Description: S/MIME Cryptographic Signature