ok programming is hard enough as it is. but to remember obscure syntax and
other such stuff is really horrible. why go through all the pain just
because bourne shell programming is the common denominator - (i think that
not forcing the user to upgrade unnecessarily is a Good Thing. but taken
to an extreme it can really be harmful to everyone...) for example, what
would you prefer, writing 1500 line shell script and actually maintaining
it for say 5 years or writing a 800 line (equivalent) python program and
not worrying about simple things such as, if the user has spaces or other
illegal character in their file names because python takes care of it for
you (i haven't programmed with python too much but i have used scsh and it
takes care of all theses thing for you). we have just seen how much
problem even a small shell script can give. so why stick with it? why not
move on to something better?
this is what i mean when i say that the system take care of things for you:
(directory-files DIR) in scsh lists all the file in DIR; doesn't matter if
they have spaces or other cruft in them...
> for i in *.mp3
> do
> mp32wav $i ${i%mp3}wav
> # use a hash, #, to change something at the front
> done
(both are untested)
In Python (
http://www.python.org/):
import os, glob
for file in glob ("*.mp3"):
newname = file[:-4] + ".wav"
os.system ("mp32wav %s %s" % (file, newname))
In Scsh (the Scheme Shell
http://www.scsh.net/)
(map (lambda (old)
(let ((new (string-append (file-name-sans-extension file)
".wav")))
(run (mp32wav ,old ,new))))
(glob "*.mp3"))