[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 11:42 AM, Manon Metten wrote:

Hi,

I'm about to learn bash or python scripting.

- Which one is easiest to learn?

That's debatable, I think. Bash's syntax is more idiosyncratic, but there's less of it.

- Which one is more powerful?

Python.

- Can I execute /bin commands from within a python script
  (something like mkdir or ls)?

I'm sure you can, although I don't know how. (I'm not a Python programmer.)


Or should I learn bash scripting anyway?

If you plan to do much system administration, learning bash scripting is worthwhile. There are three reasons I can think of right off the bat: - Every Unix-like system you encounter will have some version of the Bourne shell. Not every system will have Python. - You will often need to modify or maintain other people's bash scripts, since that's how most startup scripts and the like are written. - Simple bash scripts can be done right from the shell prompt, which is sometimes handy. 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.





Reply to: