I have been using bash for most of my system administration tasks. I also know a bit of perl.
Should I learn Python or Perl is better for system automation. So far from my experience learning perl has been easy.
|
I have been using Should I learn
| |||||||
feedback
|
|
Short answer: learn both. You are going to encounter both as a sysadmin, so you'll want to know how to read/troubleshoot/debug both. As for writing scripts, I have used mostly Perl over the last 10 years for most of my sysadmin utility and "glue" scripts. Its regex syntax is really simple, and it lends itself quite well to extremely fast script development. This is quite important when you have to get something working on-the-spot. Lately I have been making an effort to use more Python for the following reasons:
I still use Perl quite a lot, but it's now more for one-liners and "throwaway" scripts which will only run once. If I think I'm ever going to edit the script again, I consider Python instead. | |||||||||||||||
feedback
|
|
It depends on what you're trying to do, and where you're trying to do it. All things being equal, and where you have no restrictions on your environment, can install whatever you want, and don't have to worry about interoperating with legacy code, feel free to pick the language that suits your personal preferences best. That said, for sysadmin work, I do think Perl has an edge: it's installed on everything out of the box, and has been since roughly the dawn of time. If you're writing a system automation or management script and using only core Perl modules, you can be almost positive that it will run without modification everywhere in your heterogeneous UNIX environment, and can be extended fairly painlessly to Windows with an installation of ActiveState or Strawberry Perl. Hope that helps! | ||||
|
feedback
|
|
I would recommend python. I know perl enough but am not an expert and my experience with python has been vastly superior. I think it depends on your needs but if its simply for system automation I would go the python route and forget about perl (for the time being). Here is a great way to sink your teeth in: http://diveintopython.org/toc/index.html With things like Fabric in development it can really make things easier: http://docs.fabfile.org/en/1.0.0/index.html Example from the page:
Output
| |||||
feedback
|
|
They're equivalent; for a home machine, which you use depends on which one you feel more comfortable in, but when working with others you should adhere to any established standards (if everyone else uses Python you shouldn't use Perl without good reason, and vice versa). | |||
|
feedback
|