What programming language is fit for shell scripting? And could you add a sample code of a shell?

Recommended Answers

All 5 Replies

There are plenty of examples of small shells on the net - try google. I've seen them implemented in anything from C to Ruby/Python so it really boils down to what you are comfortable using.

What language is the best to be used in shell scripting?

There are several available in each of the various platforms. It really boils down to what you are most comfortable with. 'Best' is an entirely subjective measure - my 'best' is most certainly going to differ from your 'best'.

More or less by definition, shell scripting is done in the language of the shell you use. The most common these days are the Windows "batch" shell, which is very little used, but runs on all Windows machines; and bash (Born Again SHell) which is very common on Unix flavored machines, and on all Linux machines. Bash is an extension of the Bourne Shell (sh) with similarities to the Korn shell (ksh). The "C" shell (csh) was my first shell scripting language, but I no longer recommend it, preferring bash. This seems to be a pretty good intro/comparison on 30 seconds examination.

When referring to shell scripting, one usually means a Unix shell, and more specifically, one derived from Steven Bourne's 1978 shell.

A number of extensions to the Bourne shell were introduced by David Korn in the Korn shell (ksh, ks88 and ksh93).

The Korn extensions were the basis of the POSIX shell standard which is now the baseline for shell capabilities.

The POSIX shell is most closely followed (without many extensions) in the BSD shell, available on many systems as ash or dash.

Both ksh93 and bash (the Free Software Foundation's Bourne-again shell) have a number of extensions to the POSIX standard which make shell programming more powerful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.