[CLUE-Tech] mpg123 - recursively play directories? (solved?)
Keith Hellman
kehellman at yahoo.com
Tue Aug 27 08:48:56 MDT 2002
--- "Jed S. Baer" <thag at frii.com> wrote:
> Except that -exec would then invoke mpg123 once for each file ...
>
> Hey, that's what xargs is doing too. Man, I hate it when the brain goes
> on
> strike. ;-)
Just a clarification, and I mention this only because it took me by
surprise:
$ printf "1\n2\n3\n4\n5\n" |xargs echo
1 2 3 4 5
$ printf "1\n2\n3\n4\n5\n" |xargs -l echo
1
2
3
4
5
xargs will read (a configurable, but by default large) number of arguments
from standard input and invoke the target program *once* with the string
of arguments.
xargs with the -l option is most similar to the find -exec mechanism; -l
tells xargs to only provide one input line per target program invokation.
I had written an exceptionally straightforward script that simply took the
first parameter and added it to a configuration file for a specialized
development need. I did a 'find -type f -name "*.[ch]" |xargs MY_SCRIPT'
and found that only a small percentage of the actual files were ending up
in automatically built configuration file. My goof of course was that my
lame script pretty much did "echo $1 >>MY_CONFIG_FILE" instead of
for a in $* ; do echo $a >>MY_CONFIG_FILE ; done
This, coupled with xargs sending my script a bizzillion arguments at one
time (because I didn't use -l) wound up wasting the better part of a lunch
break for me :^)
=====
Keith E. Hellman
kehellman at yahoo.com
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
More information about the clue-tech
mailing list