# Best language to learn to script/automate linux?



## doktarZues (Jul 10, 2007)

I'm sure this is based a lot on opinion, and on what type of things you're doing, but what would be the best language/script to learn? Can you do just about anything with shell scripting? 

Thanks in advance


----------



## WARnux (Jun 29, 2007)

C++
Linux shell scrips are very powerful but C++ can do anything.


----------



## briealeida (Jun 3, 2007)

You also might want to look at Perl. It's sooo useful! The duct tape of the Internet.

You can get a lot done with shell scripting, too.


----------



## redbeardmcg (Jul 12, 2007)

bash, c, and perl are definately good. Many aren't aware of this, but you can build php scripts and run them from the command line that will allow you to do many things with the simplicity of php. I have found this very useful.


----------



## lotuseclat79 (Sep 12, 2003)

Hi doctarZues,

Welcome to TSG!

Shell scripting is fundamental to any Linux environment depending. For example, an OS engineer might need to learn how to deal with the primitive editor utility 'ed' to be able to edit network boot scripts in a bare (minimal) environment.

As Brie said, Perl is very useful and is probably the mainstay IT language of preference by many System Administrators to get anything done in short order.

Depending on what you are going to architect, design or program - the choice of language is very important and should fit the problem domain in which you intend to work. For example, if one is working in the area of Logic programming, one might have a strong preference to one of several languages - Lisp, Prolog and/or other languages which no one here has ever heard about.

My point is that the choice of language is very important. Yes, you can probably do anything in C++ - but, is it the right choice for what you intend to do. Still, a good language to learn about Inheritance, derived types, polymorphism and object-oriented programming. Then there are the Functional languages, and others.

The important thing to learn is how to express ideas in a language with simplicity and elegance with robust reliability and correctness - learn about Occam's razor to know what I mean - use Wikipedia to look up Occam's razor.

The 'real' foundation is all about semantics rather than syntax or how many lines you can program, etc. If you don't understand the semantics of a programming language - then you don't really know how the designer intended it to work - regardless if the implementor of the language got it right or not - usually, they will get it right.

There are three kinds of semantics wrt any language:
1) axiomatic or user semantics (programmer uses this level)
2) operational or implementor semantics, (compiler implementor uses this)
and
3) designer or mathematical semantics (only for language desingers that can express the semantics of a language in squiggly little math symbols and formulas - Hint: Action Semantics (Google it if you are interested)

Learn the axiomatic semantics first in order to learn how to program the constructs of the language. After that if you take a degree in a Computer Science program - you can learn about the others.

-- Tom


----------



## fenderfreek (Mar 14, 2006)

I can tell you from personal experience that if you're wanting to administrate or automate anything on a Linux/Unix box, you'd better be at least handy with Shell, Perl, or both. C(++) is great for writing applications, but for scripting/automated system tasks or really anything that involves parsing plain text data, it's awful if not downright useless compared to Shell or Perl.

If you're looking to write some scripts or want to learn something quickly, I'd pick up a copy of "Learning Perl" from O'Reilly. It's an awesome book written by well known Perl gurus and makes it easy to grasp the language even for programming newbies. Perl is easy to learn, and even easier to use. Once you're pretty fluent in that, Shell should be your next venture, and should be a piece of cake. With those two things down pat, your sysadmin toolbox is pretty much complete as far as programming/scripting goes.


----------

