<p>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?</p>

[{'answer_id': 70466, 'author': 'Vargen', 'author_id': 6371, 'author_profile': 'https://Stackoverflow.com/users/6371', 'pm_score': 1, 'selected': False, 'text': "<p>I have been getting Python recommended all the time. It's supposed to let you do anything. For the small tasks i use shell scripts though.</p>\n"}, {'answer_id': 70467, 'author': 'Sev', 'author_id': 83819, 'author_profile': 'https://Stackoverflow.com/users/83819', 'pm_score': 2, 'selected': False, 'text': '<p>I\'d recommend <strong>bash, awk, and sed.</strong></p>\n\n<p><strong>bash</strong> - <a href="http://tldp.org/LDP/abs/html/" rel="nofollow noreferrer">http://tldp.org/LDP/abs/html/</a></p>\n\n<p><strong>awk</strong> - <strike><a href="http://www.uga.edu/~ucns/wsg/unix/awk/" rel="nofollow noreferrer">http://www.uga.edu/~ucns/wsg/unix/awk/</a></strike></p>\n\n<p><a href="http://www.grymoire.com/Unix/Awk.html" rel="nofollow noreferrer">http://www.grymoire.com/Unix/Awk.html</a></p>\n\n<p><strong>sed</strong> - <strike><a href="http://www.ce.berkeley.edu/~kayyum/unix_tips/sedtips.html" rel="nofollow noreferrer">http://www.ce.berkeley.edu/~kayyum/unix_tips/sedtips.html</a></strike></p>\n\n<p><a href="http://www.grymoire.com/Unix/Sed.html" rel="nofollow noreferrer">http://www.grymoire.com/Unix/Sed.html</a></p>\n\n<p>Just some ideas.</p>\n'}, {'answer_id': 70468, 'author': 'Bernard', 'author_id': 61, 'author_profile': 'https://Stackoverflow.com/users/61', 'pm_score': -1, 'selected': False, 'text': '<p>On Linux? Choose your poison, basically. I like Python, others Ruby, still others Perl. Pick one and go for it. :-)</p>\n'}, {'answer_id': 70473, 'author': 'Ben', 'author_id': 11522, 'author_profile': 'https://Stackoverflow.com/users/11522', 'pm_score': 2, 'selected': False, 'text': "<p>I think it depends on how complex the tasks are you want to automate. Personally, I've always gone with shell-scripts, which enables you to call on awk, sed, grep, find, ls, cat, etc. which can be combined together to do pretty much anything you can achieve using perl or python. On the other hand, if the processes you want to automate are complex (e.g., not just a linear sequence of steps) then you'll probably find that writing the scripts in perl or python (or even ruby!) is much quicker and makes them easier to maintain.</p>\n"}, {'answer_id': 70486, 'author': 'Xetius', 'author_id': 274, 'author_profile': 'https://Stackoverflow.com/users/274', 'pm_score': 1, 'selected': False, 'text': "<p>I would usually say the one you know best which can achieve the results you want.  Like all religious wars, and after learning a large number of languages, you realise that you can do most things in most languages (Note I did say most).  I use Perl.  It is maybe not as up to date as Python or Ruby, but it does have massive library support from CPAN.  And I have not found anything I can't do in it yet.  When I do I will look at other languages to find out which one can fill that gap.  </p>\n\n<p>If I was starting today, maybe I would pick Python or Ruby, but I don't know enough about them to make a judgement call.  Do any of your friends/colleagues know scripting languages.  This could help you massively as the support when learning a new language is very important.</p>\n\n<p>Good luck</p>\n"}, {'answer_id': 70488, 'author': 'GustyWind', 'author_id': 11114, 'author_profile': 'https://Stackoverflow.com/users/11114', 'pm_score': 0, 'selected': False, 'text': '<p>That depends on which type of automation you are doing like if it is testing autoamtion Perl is suggested because Perl is much powerful  extension modules via CPAN, an online Perl module inventory.  If you only need a handy tool to complete a simple source file,  awk is very convenient. If you are planning to use the scripts to automate a big project, Perl is a better choice with more features.\nAgain Python was designed from the start as an object-oriented language. Perl 5 has some o-o features added on, but it looks to me like an awkward retrofit. Python has well-implemented o-o features for multiple inheritance, polymorphism, and encapsulation.n summary, it seems to me that Python dominates Perl in most applications except for fairly short shell-script sorts of applications, and there they are roughly comparable.</p>\n'}, {'answer_id': 70489, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 3, 'selected': False, 'text': "<p>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.</p>\n\n<p>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)</p>\n"}, {'answer_id': 70500, 'author': 'ctcherry', 'author_id': 10322, 'author_profile': 'https://Stackoverflow.com/users/10322', 'pm_score': 2, 'selected': False, 'text': "<p>Depends on the complexity and problem domain of the task at hand.</p>\n\n<p>Bash scripts are quick and dirty for simple system automation tasks. For more complex things than moving files around and running commands, I'd personally say Perl is next in line as the <em>defacto</em> sys-admin goto automation tool. For more focus on code reuse and readability/maintainability I'd want to step it up it up to Python or Ruby.</p>\n\n<p>PHP can also be used to automate tasks, however it is not widely accepted for this purpose in my experience.</p>\n\n<p>It really comes down to what language you are most interested in learning, most can be used for automation, in addition to many other things.</p>\n"}, {'answer_id': 70504, 'author': 'Vhaerun', 'author_id': 11234, 'author_profile': 'https://Stackoverflow.com/users/11234', 'pm_score': 1, 'selected': False, 'text': "<p>Well, it's like this:</p>\n\n<p>Perl is not the most user friendly scripting language, but it has CPAN (Comprehensive Perl Archive Network), which contains thousands of libraries that implement almost anything you may think of, and Perl is really powerful when it comes to text processing. The disadvantage would be that perl code is kinda hard to maintain (if you don't know it very well).</p>\n\n<p>Python is a scripting language that is becoming more and more popular among scripters. It doesn't have a community like CPAN (yet), but it's more readable, and it's easier to maintain. It's as fast as perl.</p>\n\n<p>Ruby is the newest trend in scripting languages. Ruby is full OOP, which means that everything is an object. Its advantage is that the code is very readable, and it's pretty easy to learn, if you are a beginner. The main disadvantage is its execution speed, which kinda s*x.</p>\n"}, {'answer_id': 70507, 'author': 'Simon Peverett', 'author_id': 6063, 'author_profile': 'https://Stackoverflow.com/users/6063', 'pm_score': 7, 'selected': True, 'text': "<p>The answer is: Whatever best fits the job!</p>\n\n<p>My rule of thumb;</p>\n\n<p><strong>Bash</strong> - for a short script that might need a for loop to do something repetitively.</p>\n\n<p><strong>Perl</strong> - 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</p>\n\n<p><strong>Python</strong> - 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.  </p>\n"}, {'answer_id': 70511, 'author': 'Antti Rasinen', 'author_id': 8570, 'author_profile': 'https://Stackoverflow.com/users/8570', 'pm_score': 2, 'selected': False, 'text': "<p>I prefer shell scripts only for very small tasks. Writing robust shell scripts requires a lot of knowledge about possible pitfalls, which you only learn by doing. But learning even the basics will increase your productivity a lot!</p>\n\n<p>If I need to have complex logic, I usually use Python. By complex I mean anything that has more than two if -statements =)</p>\n\n<p>Perl is okay for its original purpose, but be warned that many of the perlisms you learn are not applicable anywhere else.</p>\n\n<p>Python and Ruby are roughly equivalent. I'd recommend you learn one of them well and check out a tutorial on the other. I prefer Python but it really comes down to personal preference.</p>\n\n<p>To summarize: <strong>Learn basics of shell scripts. Learn at least Python or Ruby well.</strong></p>\n"}, {'answer_id': 70531, 'author': 'Mr Shark', 'author_id': 6093, 'author_profile': 'https://Stackoverflow.com/users/6093', 'pm_score': -1, 'selected': False, 'text': "<p>Depends on what you want to do, I regularly use all of them:</p>\n\n<ul>\n<li>Shell for simple batching of commands with perhaps a loop or an if-statement.</li>\n<li>Perl when I'm munching files and do some text replacement and souch things.</li>\n<li>Python when need more logic.</li>\n</ul>\n\n<p>Under *nix you should use the right tool for the right work, which can be hard for the beginner since it's so many things to learn (after some 15 years as a *nix user I still find new things). My recommendation is to look at all the languages quickly to see what they can do, and then start with using shell for everything, when your scripts gets clunky move them to something else.</p>\n"}, {'answer_id': 70533, 'author': 'Jonathan Bourke', 'author_id': 8361, 'author_profile': 'https://Stackoverflow.com/users/8361', 'pm_score': 3, 'selected': False, 'text': '<p>When choosing a scripting language to help automate your linux / unix environment, the most important thing in my opinion is... your replacement :-)</p>\n\n<p>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. </p>\n\n<p>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 &amp; awk is particularly powerful.</p>\n\n<p>When you have that mastered, you can come back here and ask "What scripting language should I learn after bash?" :-)</p>\n\n<p>JB</p>\n'}, {'answer_id': 70566, 'author': 'Oko', 'author_id': 9402, 'author_profile': 'https://Stackoverflow.com/users/9402', 'pm_score': -1, 'selected': False, 'text': "<p>I'd say Python - it has a very high readability, it is simple( no curly brackets, key words as close to english as possible etc.) and you can do almost everything in it, from simple to very complex things. It is also popular and fun to code.</p>\n"}, {'answer_id': 70571, 'author': 'Uresu', 'author_id': 11552, 'author_profile': 'https://Stackoverflow.com/users/11552', 'pm_score': -1, 'selected': False, 'text': "<p>This may sound a little odd, I had been using bash for over 10 years.   I have started using PHP5 and it was difficult at first, but now I have a much better reusable code base.</p>\n\n<p>I wouldn't recommend it as a starting point though!</p>\n"}, {'answer_id': 70659, 'author': 'stephanea', 'author_id': 8776, 'author_profile': 'https://Stackoverflow.com/users/8776', 'pm_score': -1, 'selected': False, 'text': '<p>Just write your commands one after the other, put it in a file and run this file with</p>\n\n<pre><code>promp&gt; bash file\n</code></pre>\n\n<p>and you have your first automation. Then learn about bash variables, loops and control structures.</p>\n'}, {'answer_id': 70700, 'author': 'Robse', 'author_id': 5739, 'author_profile': 'https://Stackoverflow.com/users/5739', 'pm_score': -1, 'selected': False, 'text': '<p>I second Python - powerful, simple, performant, and... actually quite fun, compared to perl or bash. Also if you know it, you\'ll find other uses, it\'s used in a lot of projects. \nAnd not just as a "classic" scripting language, take for example the twisted project. That\'s true for Perl too I guess, but I like Python better order of magnitudes myself</p>\n\n<p>Bottom line though is like has been said beofre, make sure you have the right tool for the job...</p>\n'}, {'answer_id': 70766, 'author': 'dogbane', 'author_id': 7412, 'author_profile': 'https://Stackoverflow.com/users/7412', 'pm_score': 0, 'selected': False, 'text': "<p>If I had to pick one, it would have to be AWK. It's lightweight, has a small learning curve and has many useful functions like index and substr.</p>\n"}, {'answer_id': 70789, 'author': 'Eric Wilhelm', 'author_id': 11580, 'author_profile': 'https://Stackoverflow.com/users/11580', 'pm_score': 3, 'selected': False, 'text': "<p>I use Perl for anything beyond extremely simple scripts.</p>\n\n<p>I also <code>'use warnings'</code>, <code>'use strict'</code>, avoid backticks, call system as <code>'system($command, @and_args)'</code>.  And because I like it to be maintainable:  IPC::Run (for pipes), File::Fu (for filenames, tempfiles, etc), YAML (for configs or misc data), and Getopt::Helpful (so I can remember what the options were.)</p>\n"}, {'answer_id': 124497, 'author': 'Joe Pineda', 'author_id': 21258, 'author_profile': 'https://Stackoverflow.com/users/21258', 'pm_score': -1, 'selected': False, 'text': '<p>If you aim at having a simple script program "controlling" another (command-line, of course) program, then you should review Tcl/Tk, especially its dialect expect - they\'re simple and oriented towards that goal - it\'s very easy to create a script that controls ftp and even does a su with them!</p>\n\n<p>Awk\'s very nice to process text files - not as powerful as perl, yet much more simple and straightforward (and without the horrible syntax).</p>\n\n<p>Of course, your mileage may vary, so I guess the best answer would be to ask you: what do you want to write scripts for? And then: Are you familiar with <em>any</em> language script? The answers to these questions will point you to the scripting language you should use, according to the pros/cons of each one and their main target.</p>\n'}, {'answer_id': 2297198, 'author': '0x69', 'author_id': 277053, 'author_profile': 'https://Stackoverflow.com/users/277053', 'pm_score': 1, 'selected': False, 'text': '<p>If you want minimalistic, compact and fast solution (faster than Python/Ruby) then -> go for LUA scripting language :-)\nHowever Lua speed &amp; code compactness is achieved by relativelly small Lua language core, so if you want "batteries included" (aka. very big "standard" libraries) then Lua is not for you. Otherwise, guys who come from C/C++ world very enjoys Lua speed :-)</p>\n\n<p>p.s.</p>\n\n<p>Lua vs Ruby 1.9 benchmark (you can look also Lua Vs Python 3):</p>\n\n<p><a href="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&amp;lang=lua&amp;lang2=yarv" rel="nofollow noreferrer">http://shootout.alioth.debian.org/u32/benchmark.php?test=all&amp;lang=lua&amp;lang2=yarv</a></p>\n'}]
['https://Stackoverflow.com/questions/70453', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11372/']