Scripting alternatives to Bash shell scripts

I have just migrated to a UNIX workstation. My memory of Bash shell scripts has faded since school and I find the syntax to be highly confusing. I am wondering what other scripting languages are used to automate tasks. The two most popular ones that I have heard of are Perl and Python.

  1. Which scripting language is most widely used by real world shops ?
  2. Which scripting language most closely resembles C/C++ syntax ?
  3. Is there another scripting language that I am not aware of ?

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