Complete.Org: Mailing Lists: Archives: linux-help: April 2004:
[linux-help] Re: mp3 sorting issues :(
Home

[linux-help] Re: mp3 sorting issues :(

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: linux-help@xxxxxxxxx
Subject: [linux-help] Re: mp3 sorting issues :(
From: Carl D Cravens <raven@xxxxxxxxxxx>
Date: Sun, 18 Apr 2004 22:25:31 -0500 (CDT)
Reply-to: linux-help@xxxxxxxxx

On Sun, 18 Apr 2004 dustin@xxxxxxxx wrote:

> bash .. i kindof hacked together something that is currently working using
> nested for statements, but it just doesn't feel right..

You can get a list of all the files you want with something like

find /var/music -name '*.wav'

You could then pipe it to xargs or include it into a for-loop if you
expect a fairly short list.  If you expect a long list that'll cause
memory issues, redirect to a file.

I learned Perl (v4) before I really got into shell programming, but
nowdays I do a lot of shell stuff when Perl is overkill.  Sometimes I find
myself waffling over which is most appropriate for a particular
application.  Often I start programming a bash script and find that I need
to do a lot of text manipulation and convert it to Perl.  Sometimes I go
the other way.  Recently, I even did both... started in bash, converted to
Perl, decided that bash was actually a little more elegant.

Of course, knowing the shell well helps... if you find yourself stumbling
through shell programming but know Perl well, turning to Perl may be the
easier solution.  But I've gotten to know the shell well enough that I
write relatively complex scripts on the command line for one-off tasks.
For-loops and xargs are my very close friends.  And the variable
modification operators (#, %, etc) are good acquaintances.

If you spend any real amount of time at the shell prompt, take the time to
get to know it.  It will be worth it.

--
Carl D Cravens (raven@xxxxxxxxxxx)
A man about to speak the truth should keep one foot in the stirrup.
-- This is the linux-help@xxxxxxxxx list.  To unsubscribe,
visit http://www.complete.org/cgi-bin/listargate-aclug.cgi


[Prev in Thread] Current Thread [Next in Thread]