[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash vs. python scripts - which one is better?



On 2007-08-14 09:32:44 -0400, 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

which is almost as bad, as filenames can have \n characters in them.
That's why "find" has -print0... Unfortunately the "read" builtin
doesn't seem to support this feature (or anyone knows how to use
its -d option to declare \0 as the delimiter?).

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



Reply to: