[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash vs. python scripts - which one is better?



On Tue, Aug 07, 2007 at 03:14:42PM -0700, David Brodbeck wrote:
>
> On Aug 7, 2007, at 2:39 PM, Vincent Lefevre wrote:
>>> - Every Unix-like system you encounter will have some version of the 
>>> Bourne
>>> shell. Not every system will have Python.
>>
>> Not every system has bash.
>
> Well, yeah.  That's why I said "Bourne shell" and not "bash."
>
>> I now write all my portable scripts in Perl since it
>> is on every system I've met.
>
> It's not any more guaranteed than bash, though.  For example, FreeBSD no 
> longer includes Perl with the base system; you have to install it as a 
> port.
>
>>>   Stuff like 'for FILE in `ls *.wav` ; do lame -h -b 160 $FILE $FILE.mp3 
>>> ;
>>> done' to encode a bunch of WAV files to MP3, to give a crude example.
>>
>> This one is bad. Really.
>>
>>   for FILE in *.wav; do lame -h -b 160 "$FILE" "$FILE.mp3"; done
>>
>> This is another reason why sh sucks. It's too easy to write broken
>> things.


So what's the right way to do this? I hacked one together the other
day:

IFS=$'\t\n'; for i in `find . -iname \*m4a`; do faad... blah blah blah

and I knew it was a hack because setting $IFS just seems
bad... possible unintended consquences, but it worked.

A

Attachment: signature.asc
Description: Digital signature


Reply to: