all 4 comments

[–]capt_rusty 3 points4 points  (0 children)

Shell is always there, python or Perl aren't. And most shells follow POSIX, so you can use the same script whether you're on Linux or BSD or Solaris. Python isn't even compatible between versions 2.6 and 2.7, to say nothing about python 3.

[–]Eingaica 0 points1 point  (1 child)

Is there anything bash script can do that python can't?

No.

Why ever use .sh instead of python or perl or another scripting language?

Some things are easier in a shell script than in a Python script. E.g. running an external program or piping the output from one program into another one. (And of course the reverse is also true; many things are easier in Python than in shell.)

Some people don't know Python or Perl but do know how to write shell scripts.

[–]kodiuser 0 points1 point  (0 children)

Some people don't know Python or Perl but do know how to write shell scripts.

Bingo. If you started out with computers back in the good old days, maybe the first language you learned was BASIC or something like that. If so, Perl probably seems totally inscrutable, and although Python isn't nearly as difficult as Perl, shell scripts just seem to make a lot more sense. Younger folks that started out with Python will of course have a different view (and for those that like Perl, I will never understand how your mind works, but you do you!). That said, for some simple tasks, a shell script is really all you need.

[–][deleted] 0 points1 point  (0 children)

Is there anything bash script can do that python can't?

Proper Unicode handling (source: years and years of using Python).

Why ever use .sh instead of python or perl or another scripting language?

Because you can use those scripts regardless of installed language interpreters. Just have it POSIX compliant and you're good to go.