Hi Steve, On 8/9/07, Steve Lamb <[EMAIL PROTECTED]> wrote:
> Or should I learn bash scripting anyway? > > Learn enough to be able to parse it and convert it to your language of > choice. That's a valuable advice. It'll save me a lot of time and yet I'll be able to achieve what I want. import os > for file in os.listdir('.'): > root, ext = os.path.splitext(file) > if ext.lower() == 'wav': > mp3 = root + '.mp3' > result = os.system("lame -h -b 160 '%s' '%s'" % (file, mp3)) > if result: > print '%s not converted' % file Longer, yes. Easier to follow? Most certainly. Superior, no > doubt. The > shell example would miss WAV, Wav, wAv, etc. Secondly the only place we > need > to escape the variable is when we need shell to do some work, namely the > call > to lame. Finally we don't end up with '.wav.mp3' files all over the > place. > We can check the results easily and handle failures gracefully. Can all > of > that be done in shell? Certainly. Is it worth doing in shell? Not > hardly. On my Amiga I'm used to ARexx. It has some same advantages over AmigaDOS like you describe above about bash vs. python. Fortunately there's regina-rexx for Linux. It has the same syntax and I've already written some scripts combining regina-rexx and grep. But I think the scope of regina-rexx is somewhat limited compared to python. But for the moment I can use it and gradually learn bash, python, perl or whatever suits me. Greetings, Manon.