Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Scripting language is best? [closed]

Tags:

For writing scripts for process automisation in Linux platform, which scripting language will be better? Shell script, Perl or Python or is there anything else? I am new to all of them. So, am just thinking to which one to go for?

like image 259
Sreenath Avatar asked Sep 16 '08 08:09

Sreenath


3 Answers

The answer is: Whatever best fits the job!

My rule of thumb;

Bash - for a short script that might need a for loop to do something repetitively.

Perl - anything to do with some kind of text processing or file processing, especially if it's a one off. Just do a dirty nasty perl script and be done with it

Python - If it's something you might want to do again or something very like it. Then at least you have a chance of being able to reuse the script.

like image 175
Simon Peverett Avatar answered Nov 12 '22 06:11

Simon Peverett


Go for all three of them, start with bash/awk/sed plus fileutils (grep, find, and so on) and then move up the abstraction hierarchy with perl and python.

That way you will be able to decide for yourself which one fits your needs best. I say start with bash and friends because they are ubiquitous, some machines will not have perl or python installed and you'll feel helpless there, especially in traditional unix land (ie, not linux)

like image 27
Vinko Vrsalovic Avatar answered Nov 12 '22 05:11

Vinko Vrsalovic


When choosing a scripting language to help automate your linux / unix environment, the most important thing in my opinion is... your replacement :-)

By which I mean the next / other sysadmins who may have to maintain your scripts. I am currently working in an environment where the lead Unix guy is a real script head, but he has mainly restrained himself to using bash, with some perl and windows vbscript thrown in for good luck. At least it has forced me to brush up my perl.

While agreeing with the other comments here, my suggestion would be to master bash - where possible do as much as possible in bash, as most people know it, and can maintain / debug it. And it will be most portable. Use with sed & awk is particularly powerful.

When you have that mastered, you can come back here and ask "What scripting language should I learn after bash?" :-)

JB

like image 40
Jonathan Bourke Avatar answered Nov 12 '22 07:11

Jonathan Bourke