ABSTRACT

This chapter discusses numeric data processing, the signal/interrupt processing capability of Bash, functions in Bash including parameter passing and scoping of variables, and debugging of Bash scripts. There are three ways to perform arithmetic operations on numeric data in Bash without performing string to integer conversion and vice versa. These methods are by using the let command, by using the shell expansion $((expression)) and by using the expr command. Bash has powerful input/output (I/O) features that allow explicit processing of files. The chapter describes how standard input of a command in a shell script can be redirected from data within the script, and how file input/output can be performed using file descriptors and how standard files can be redirected from within a shell script. It covers the following commands and primitives: |, <, >, >>, <<<, bc, clear, declare, exec, expr, grep, kill, let, local, more, read, readonly, sort, stty, trap.