Linked by Eugenia Loli on Fri 14th Sep 2007 23:08 UTC
General Development As a system administrator, you run across numerous challenges and problems. Managing users, disk space, processes, devices, and backups can cause many system administrators to lose their hair, good humor, or sanity. Shell scripts can help, but they often have frustrating limitations. This is where a full-featured scripting language, such as Python, can turn a tedious task into an easy one. Python is a scripting language that looks like it was made for system administrators.
Thread beginning with comment 271436
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: +1 for Perl
by mmcgreal on Sat 15th Sep 2007 02:02 UTC in reply to "+1 for Perl"
mmcgreal
Member since:
2006-09-12

There is 1 problem with Python as a language for a "Systems Administrator". That problem is that perl is installed by default on ever unix variant under the sun and python isn't.


So, install it.

Plus it's harder to write one-liners with Python, with the whitespace requirement and all.


Seriously, how many times per year do you use a PERL one-liner from the command line? 4? Maybe 5 times?

Plus there's no support for writing setuid scripts with Python.


This is not a safe practice in any interpreted language. Better to write those sections using a compiled language, take your choice.

Its syntax is closer to C and shell...


... and about a dozen other languages and tools. Its syntax is certainly the most expansive syntax of any programming language in history. You might think that's a good thing, but try picking up a piece of code someone else wrote in Perl, and maintaining it.

We have been installing Python on all our Unix boxes for about 5 years now, and I think it was a great move.

ksh93, Python, C. That's all you need for every Unix administrative programming project. And the C is only needed when you need to wrapper a system call into a Python function. They're used in descending order of frequency: ksh93 - 70%, Python - 25%, C - 5%.

Reply Parent Score: 3

RE[2]: +1 for Perl
by netpython on Sat 15th Sep 2007 08:57 in reply to "RE: +1 for Perl"
netpython Member since:
2005-07-06

bash,sed/awk,perl,C fits my bill :-)

Reply Parent Score: 2

RE[3]: +1 for Perl
by Doc Pain on Sat 15th Sep 2007 13:10 in reply to "RE[2]: +1 for Perl"
Doc Pain Member since:
2006-10-08

"bash,sed/awk,perl,C fits my bill :-)"

Sidenote: Don't declare bash as long as you're not using special bash features that are not present in standard sh. sh is the most basal common sense in UNIX scripting. bas isn't (allthough it's very famous in Linux).

Furthermore, I agree to the command set above for most administration tasks that need to be automated. sed and awk are very powerfull, especially when you want to implement "small" tasks with few commands. On the other hand, I like using Python and Ruby for several tasks, but I never thought seriously about using them intensively for administrative tasks. I'll go out and correct my attitude. :-)

Reply Parent Score: 2

RE[3]: +1 for Perl
by CrLf on Sat 15th Sep 2007 20:40 in reply to "RE: +1 for Perl"
CrLf Member since:
2006-01-03

"Seriously, how many times per year do you use a PERL one-liner from the command line? 4? Maybe 5 times?"

And the fact that 99.9% of perl one-liners result from people not knowing how to use "sed" and "grep".

Reply Parent Score: 2

RE[4]: +1 for Perl
by dagw on Sun 16th Sep 2007 13:33 in reply to "RE[3]: +1 for Perl"
dagw Member since:
2005-07-06

Actually I find 99.9% of perl one-liners result from perl nerds trying to show off, and prove that it can be done.

Reply Parent Score: 2