ABSTRACT

The Bourne again shell (Bash) is more than a command interpreter. It has a programming language of its own that can be used to write shell programs for performing various tasks that cannot be performed by any existing command. This chapter introduces the concept of shell programming. It discusses how shell programs are executed, how command line arguments are passed to shell programs, the various control structures for Bash scripting and some Bash scripts. The chapter describes the concept and use of shell variables. There are two types of shell variables: environment variables and user-defined variables. The chapter covers the following commands and primitives: bash, break, case, continue, exit, export, env, for, if, ls, read, readonly, set, sh, shift, test, uname, while, until, and unset.