CMPSC 311, Introduction to Systems Programming

Shell Scripts, Part 2



References



Special Commands (but not the complete list)

Items in square brackets [] are optional.

Loop control, etc.

break [n] Exit from the enclosing for or while loop, if any.
If n is specified, break n levels.
continue [n] Resume the next iteration of the enclosing for or while loop.
If n is specified, resume at the n-th enclosing loop.
exit [n] Causes the calling shell or shell script to exit with the exit status specified by n.
If n is omitted the exit status is that of the last command executed.
An EOF (control-D as keyboard input) will also cause the shell to exit.
return [n] Causes a function to exit with the return value specified by n.
If n is omitted, the return status is that of the last command executed.
shift [n] The positional parameters from $n+1 ... are renamed $1 ... .
If n is not given, it is assumed to be 1.


Job control, intended for interactive use only.

More special commands

Shell variables (not a complete description)



Some more features


Last revised, 25 Feb. 2013