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

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




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.

Good catch, and I should have known better than to throw something like that out there instead of using a real, debugged example. Every language has its issues; with bash it's argument escaping.

Personally I think filenames with spaces in them are an abomination that should have never been permitted, but I lost that argument ages ago. ;)




Reply to: