Scripting alternatives to Bash shell scripts

Solution 1:

To some degree it's a matter of personal preference. Perl and Python are definitely up there in terms of popularity.

To answer two of your three questions, though:

  1. I would guess that bash is most widely used, probably followed by perl. Just guessing though, dunno if anyone has done a survey. :)
  2. There are bazillions of scripting languages out there. :)

My recommendation is Python though. It's easy to read and write, immensely powerful, and there are tons of useful resources on the web for learning it, not to mention code that you can copy and re-purpose.

Solution 2:

Perl and Python are the obviously answers; but each of them is used to complete different tasks:

  1. Bash - Hands down the easiest to learn. With Bash scripts you run commands and manipulate the output.
  2. Python - Second easiest to learn. Python is way more useful than Bash since you can use Python to write full programs, and it's well supported by the community. Python is also extremely readable and easy to edit months later.
  3. Perl - The best of the three (for scripting), but easily the steepest learning curve. Has very good regular expression support (which is the main reason it's still in use today), and you'll probably run into a lot of Perl scripts over time. The main problems with Perl is code readability -- months after you write code you won't be able to figure out what it does. So you'd better comment heavily.
  4. Awk/Sed - Both very useful, but both very hard to learn. I'd suggest tackling these last, unless you're good at patterns.

Concerning which one to learn right now (since you presumably know none of them), I'd learn Python. It's the simplest and most useful to know.

And as for the answers to your questions:

Which scripting language is most widely used by real world shops ?

All of them, but I'd imagine that Perl has a little bit of an advantage here (being that it's been in use in system administration for much longer).

Which scripting language most closely resembles C/C++ syntax ?

Perl

Is there another scripting language that I am not aware of ?

Ruby, Tcsh/Csh, http://en.wikipedia.org/wiki/Interpreted_language


Solution 3:

awk for small jobs, python for more-than-oneliners.

Python (if you don't use specific APIs and other platform dependent things) has a rich "standard library" which is available on all platforms where you get the python version in use. This is very nice as you can re-use your scripts easily and means your knowledge is a good investment even if you change your platform.

In our company we use python for all scripting, monitoring, ... and java for The application, and we're well off in heterogeneous environment.


Solution 4:

Sh (bourne shell), grep, awk and sed is always a good thing to get to grips again. Perl is excellent if you wan't a lot of text regexing and maintainability is not that important (not saying that it is not possible). Python; if readability is important to you. My preference is Python but all these tools are good for most thing you throw at it. You might want to reconsider you c/c++ syntax requirement, keeping stuck on it won't help you in the long run.


Solution 5:

  • Ruby
  • Python
  • Go - a cross-platform language, scripting is mentioned as one of Go's strengths.
  • Node.js - see Grunt.js, Gulp.js. Many projects are now using Node.js as a shell automation tool.
  • Perl

Tags:

Unix

Scripting