Scripts are programs that do not need to be compiled into machine code to be executed. Scripts are instead executed via another program, called the interpreter.

This is usually slower than a compiled executable, but easier to tweak, allowing more rapid development.

Scripting languages tend to also specialize towards certain goals. Shells make it easy to run programs and perform text manipulation, Ruby and PHP are used for server-side web applications, Python and Perl are general purpose, Lua is small, fast and easy to embed into other programs.

The lines have between scripted and compiled languages are blurred by the presence of bytecode VMs, where the language is compiled into an intermediate form; and JIT compilation turning an interpreted language into machine code.

Common scripting languages

Shell

Shells are the most common scripting language, installed on the vast majority of all Linux systems.

Shells broadly fall into two categories:

  1. Bourne Shells
  2. C-Shells

Bourne Shells

Bourne shells are named for the shell they are derived from.

Bash is the GNU shell, the name means Bourne Again SHell. It is much more advanced, providing support for arrays and autocompletion.

Zsh is more capable, with many more features and nicer array syntax.

Busybox ash and dash are less featureful shells than Bash and Zsh, with goals of being small, fast and POSIX compatible.

Shell scripts are fundamental to traditional Linux systems, the traditional SysV init has shell scripts for every system service. These can be found in /etc/init.d

C Shells

C-Shells ape C syntax in an effort to be more familiar, but can be less capable than their Bourne cousins.

I am biased in this regard, but please read Csh programming considered harmful.

tcsh is the most commonly used C-shell.

Perl

Perl is inspired by shells and sed. It provided a fully capable programming language with built-in regular expressions.

It is a mature language with many modules available in CPAN so a variety of well-used libraries are available to ease development.

It has a reputation of being a write-only programming language, the motto of "There's more than one way to do it" does not help in this regard, as it is a large language, so it can be easy to encounter unfamiliar constructs.

apt-file, part of debian's package manager is written in Perl.

Python

Python is another general-purpose scripting language.

It has a reputation for having "batteries included", since the default builds include a large standard library.

This makes it easy to put together a program for the same reasons as perl.

It is somewhat controversial for its enforced coding style, indentation is mandatory and the community encourages common idioms. This makes python codebases easier to read since there is less of a coding style hurdle in the way of understanding.

The lsb-release script in debian is written in Python.

Lua

Lua is a fast, small, portable scripting language.

It does not include a very large standard library, providing approximately the same features as the standard C library, but it is fast and easy to embed in other programs.

LuaJIT is an alternative interpreter which offers speeds comparable to writing native C.

Lua is found in pretty much every computer game, World of Warcraft is a notable example.

PHP

PHP is a scripting language used primarily for web development. It offers powerful templating functionality, though this tends not be be used so much recently, in favour of complicated frameworks.

It has a reputation for being insecure, complicated and inconsistent.

Ruby and Python are more popular alternatives.

Ruby

Ruby is another web scripting language. It is what all the cool kids are using these days.

It has a reputation of being susceptible to dependency hell, though tools like rvm have been developed to deal with this.

puppet is a popular cluster administration tool which is written in ruby.

Writing and executing scripts

Interpreters allow scripts to be run by passing the file name of the script when executing the interpreter. For example, a shell script can be executed by running

$ cat >hello.sh <<EOF
echo Hello World
EOF
$ sh script.sh
Hello World

Alternatively, scripts can be made to behave like compiled executables with a she-bang.

$ cat >hello.sh <<EOF
#!/bin/sh
echo Hello World
EOF
$ chmod +x hello.sh
$ ./hello.sh
Hello World

The line #!/bin/sh says to use /bin/sh to run the script.

These examples were written in shell, but all the listed examples may be used instead.

With puppet, one can manage servers, workstations, etc. - it is not limited to clusters (the way the sentence is phrased somewhat implies that).
Comment by Raf Sat Jan 4 22:24:24 2014