A.1. The Bourne Shell
bash is almost
completely backward-compatible with the Bourne shell.
The only
significant feature of the latter that bash
doesn't support is ^ (caret) as a synonym for the pipe (|)
character. This is an archaic feature that the Bourne shell includes
for its own backward compatibility with earlier shells. No modern
UNIX version has any shell code that uses ^ as a pipe.
To describe the differences between the Bourne shell and
bash, we'll go through each
chapter of this book and enumerate the features discussed in the
chapter that the Bourne shell does not support.
Although some versions of the Bourne shell exist that include a few
bash features, we refer to the standard Bourne shell that
has been around for many years.
- Chapter 1
-
The cd
- form of the cd command;
tilde (~) expansion; the jobs command; the help built-in.
- Chapter 2
-
All. (That is, the Bourne shell doesn't support any
of the readline, history, and editing features
discussed in this chapter.)
- Chapter 3
-
Aliases; prompt string customization;
set options. The Bourne shell
supports only the following: -e,
-k, -n, -t,
-u, -v, -x, and
-. It doesn't
support option names (-o). The
shopt built-in. Environment files
aren't supported. The following built-in variables
aren't supported:
All variables beginning with BASH_
|
All variables beginning with COMP
|
CDPATH
|
DIRSTACK
|
FCEDIT
|
FUNCNAME
|
GROUPS
|
HISTCMD
|
HISTCONTROL
|
HISTFILE
|
HISTIGNORE
|
HISTSIZE
|
HISTFILESIZE
|
HOSTFILE
|
HOSTNAME
|
HOSTTYPE
|
IGNOREEOF
|
INPUTRC
|
LANG
|
LC_ALL
|
LC_COLLATE
|
LC_MESSAGES
|
LINENO
|
MACHTYPE
|
MAILCHECK
|
OLDPWD
|
OPTARG
|
OPTERR
|
OPTIND
|
OSTYPE
|
PIPESTATUS
| |
PS3
|
PS4
|
POSIXLY_CORRECT
|
PROMPT_COMMAND
|
PWD
|
RANDOM
|
REPLY
|
SECONDS
|
SHELLOPTS
|
SHLVL
|
TIMEFORMAT
|
TMOUT
|
auto_resume
|
histchars
|
- Chapter 4
-
Functions; the type command; the local command; the ${#parameter} operator; pattern-matching
variable operators (%, %%, #,
##). Extended pattern matching.
Command-substitution syntax is different: use the older `command` instead of $(command). The built-in
pushd and popd commands.
- Chapter 5
-
The !
keyword; the select construct
isn't supported. The Bourne shell return doesn't exit a script
when it is sourced with . (dot).
- Chapter 6
-
Use the external command
getopt instead of getopts, but note that it
doesn't really do the same thing. Integer arithmetic
isn't supported: use the external command
expr instead of the $((arithmetic-exp)) syntax. The arithmetic conditional
((arithmetic-exp)) isn't supported; use the
old condition test syntax and the relational operators -lt, -eq,
etc. Array variables are not supported. declare and let aren't supported.
- Chapter 7
-
The command, builtin, and enable built-ins. The -e and -E
options to echo are not supported.
The I/O redirectors >| and
<> are not supported. None of
the options to read is supported.
printf is usually available as an
external command.
- Chapter 8
-
Job control—specifically, the
jobs, fg, and bg
commands. Job number notation with %, i.e., the kill and wait
commands only accept process IDs. The - option to trap (reset trap to the default for that
signal). trap only accepts signal
numbers, not logical names. The disown built-in.
- Chapter 9
-
The DEBUG, ERR,
and RETURN fake signals are not supported. The EXIT fake signal is
supported as signal 0.
- Chapter 10
-
The ulimit command and privileged mode
aren't supported. The -S option to umask is not supported. The Bourne
shell's restrictive counterpart,
rsh, only inhibits assignment to PATH.
|