[Reformatted broken quoting; apologies if there are incorrect
attributions.]

David Geoffrion wrote:
> The best I can come up with is to throw them all on the command line
> with a program like xargs, but it's a bit tricky because mp3's often
> have spaces in the names which makes madplay treat each part of the
> name as a separate file which will obviously not make it make pretty
> sounds.
>
> find /home/msteeds/Music/ -name \*[mM][Pp]3 | awk '{print "\""$0"\""}'

Your pipeline will fail if you encounter a file with a quotation mark.
It is safer to delimit filenames with null (valid filenames cannot
contain / or \0), by using:

    find -print0 | xargs -0 madplay

BTW: sed 's/.*/"&"/' instead of the awk statement.  Also -iname \*.mp3 .


Alexander Boulgakov wrote:
> #find /home/myname/mp3dir -name Radiohead\*.mp3 > rhplaylist
> #for file in rhplaylist; do madplay $file; done

I suspect you mean "for file in `cat rhplaylist`".  This is bad because
the subshell may expand to a large string which the shell will dislike.
You could rewrite it as:

    find path -print | while read var; do madplay $var; done


On Tue, Nov 26, 2002 at 04:55:21PM -0600, David Geoffrion wrote:
> Matthew Seeds wrote:
>> How would I put all the files on the command line at once if I have
>> them listed in a file or pull them with a find command?
>
> xargs does put them all on the command line, it doesn't call multiple
> instances

xargs may invoke multiple instances.  Its use is to overcome the limited
environment space.  For instance, 'rm *' in a directory with many files
would fail.  In this case you want to use 'ls | xargs rm'.  xargs will
invoke rm with as many filenames as it can, which may involve multiple
rm to remove all the files.


A good free reference for shell scripting is the Advanced Bash-Scripting
Guide[1].  I also recommend the classic _The UNIX Programming
Environment_ and _Unix Power Tools_.

[1] http://en.tldp.org/LDP/abs/html/

-- 
Andrew Gaul
http://gaul.org/
_______________________________________________
Siglinux mailing list
[EMAIL PROTECTED]
http://www.utacm.org/mailman/listinfo/siglinux

Reply via email to