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

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



> 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.

it's the backtick sub-shell that stands out to me. As
others have pointed out, find's -exec argument is very
useful:

    find . -iname '*m4a' -exec faad .... {} \;

However I haven't used it in a long time, preferring to
instead use -print0 and xargs -r0

    find . -iname '*m4a' -print0 | xargs -r0 -n1 faad ...

In many cases (such as the mass-gzip someone else provided)
xargs will be significantly more efficient as it will only
spawn as many sub-processes as is required. In your faad
example, I expect you need one faad process per input file,
so -n1 is necessary.


-- 
Jon Dowland



Reply to: