This shell script and shell programming site aims to provide book reviews and free ebook on bash shell, korn shell, shell commands, linux shell, awk shell, unix commands, ftp shell and all other shells.

Shell Scripts and Awk

By Tim Love
Shell Programming
The `shell' is a process that lets you edit your command line input then runs the command. The shell isn't only a command line interpreter and line editor though, it's also a language with variables, arrays, functions and control structures. Command lines can be put into a file and executed. These so-called shell scripts can quickly be written and tested and should be tried in association with other standard unix utilities before embarking on a higher level language, at least for prototyping purposes.
Various shells are in use. sh, the Bourne Shell, is the oldest. The C-shell (csh) has many useful features lacking from sh but isn't that good for programming in. The Korn Shell (ksh) and the (very similar) POSIX shell are developments of sh that incorporates many csh features. bash is similar and is freely available (it's the default on linux and MacOS 10.3). This document is aimed at Korn Shell and POSIX shell users on CUED's Teaching System, though non-csh users elsewhere shouldn't have any problems.
Writing a shell script is easy - start up your editor with a file called try then type a few harmless commands into this file, one per line. For example
hostname
date
ls
then save it as text. You want to make this file executable, so in the terminal window type `chmod u+x try', adding eXecute permission for the Xser. Run this script by typing its name.
Even scripts as simple as this can save on repetitive typing, but much more can be easily achieved.

Followers