Conditionals are discussed in detail in Chapter 7 .
More information about the file descriptors in Section 8.2.3 .
1.2.2.5. Shell arithmetic
The shell allows arithmetic expressions to be evaluated, as one of the shell expansions or by the let built-in.
Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. The operators and their precedence and associativity are the same as in the C language, see Chapter 3 .
1.2.2.6. Aliases
Aliases allow a string to be substituted for a word when it is used as the first word of a simple command. The shell maintains a list of aliases that may be set and unset with the alias and unalias commands.
Bash always reads at least one complete line of input before executing any of the commands on that line. Aliases are expanded when a command is read, not when it is executed. Therefore, an alias definition appearing on the same line as another command does not take effect until the next line of input is read. The commands following the alias definition on that line are not affected by the new alias.
Aliases are expanded when a function definition is read, not when the function is executed, because a function definition is itself a compound command. As a consequence, aliases defined in a function are not available until after that function is executed.
We will discuss aliases in detail in Section 3.5 .
1.2.2.7. Arrays
Bash provides one-dimensional array variables. Any variable may be used as an array; the declare built-in will explicitly declare an array. There is no maximum limit on the size of an array, nor any requirement that members be indexed or assigned contiguously. Arrays are zero-based. See Chapter 10 .
1.2.2.8. Directory stack
The directory stack is a list of recently-visited directories. The pushd built-in adds directories to the stack as it changes the current directory, and the popd built-in removes specified directories from the stack and changes the current directory to the directory removed.
Content can be displayed issuing the dirs command or by checking the content of the DIRSTACK variable.
More information about the workings of this mechanism can be found in the Bash info pages.
1.2.2.9. The prompt
Bash makes playing with the prompt even more fun. See the section Controlling the Prompt in the Bash info pages.
1.2.2.10. The restricted shell
When invoked as rbash or with the --restricted or -r option, the following happens:
The cd built-in is disabled.
Setting or unsetting SHELL , PATH , ENV or BASH_ENV is not possible.
Command names can no longer contain slashes.
Filenames containing a slash are not allowed with the . (source ) built-in command.
The hash built-in does not accept slashes with the -p option.
Import of functions at startup is disabled.
SHELLOPTS is ignored at startup.
Output redirection using > , >| , >< , >& , &> and >> is disabled.
The exec built-in is disabled.
The -f and -d options are disabled for the enable built-in.
A default PATH cannot be specified with the command built-in.
Turning off restricted mode is not possible.
When a command that is found to be a shell script is executed, rbash turns off any restrictions in the shell spawned to execute the script.
More

