sh behavior.
bind builtin.
history and fc builtins to manipulate it.
csh-like history expansion
(see History Interaction).
$'...' quoting syntax, which expands ANSI-C
backslash-escaped characters in the text between the single quotes,
is supported (see ANSI-C Quoting).
$"..." quoting syntax to do
locale-specific translation of the characters between the double
quotes. The `-D', `--dump-strings', and `--dump-po-strings'
invocation options list the translatable strings found in a script
(see Locale Translation).
! keyword to negate the return value of
a pipeline (see Pipelines).
Very useful when an if statement needs to act only if a test fails.
time reserved word and command timing (see Pipelines).
The display of the timing statistics may be controlled with the
TIMEFORMAT variable.
select compound command, which allows the
generation of simple menus (see Conditional Constructs).
[[ compound command, which makes conditional
testing part of the shell grammar (see Conditional Constructs).
alias and unalias
builtins (see Aliases).
(( compound command
(see Conditional Constructs),
and arithmetic expansion (see Shell Arithmetic).
export
command.
%', `#', `%%'
and `##' expansions to remove leading or trailing substrings from
variable values (see Shell Parameter Expansion).
${#xx}, which returns the length of ${xx},
is supported (see Shell Parameter Expansion).
${var:offset[:length]},
which expands to the substring of var's value of length
length, beginning at offset, is present
(see Shell Parameter Expansion).
${var/[/]pattern[/replacement]},
which matches pattern and replaces it with replacement in
the value of var, is available (see Shell Parameter Expansion).
${!word}
(see Shell Parameter Expansion).
$9 using
${num}.
$() form of command substitution
is implemented (see Command Substitution),
and preferred to the Bourne shell's `` (which
is also implemented for backwards compatibility).
UID, EUID, and GROUPS), the current host
(HOSTTYPE, OSTYPE, MACHTYPE, and HOSTNAME),
and the instance of Bash that is running (BASH,
BASH_VERSION, and BASH_VERSINFO). See Bash Variables,
for details.
IFS variable is used to split only the results of expansion,
not all words (see Word Splitting).
This closes a longstanding shell security hole.
extglob
shell option is enabled (see Pattern Matching).
sh does not separate the two name spaces.
local builtin, and thus useful recursive functions may be written.
sh, all variable assignments
preceding commands are global unless the command is executed from the
file system.
<>' redirection operator, allowing a file to be
opened for both reading and writing, and the `&>' redirection
operator, for directing standard output and standard error to the same
file (see Redirections).
noclobber option is available to avoid overwriting existing
files with output redirection (see The Set Builtin).
The `>|' redirection operator may be used to override noclobber.
cd and pwd builtins (see Bourne Shell Builtins)
each take `-L' and `-P' builtins to switch between logical and
physical modes.
builtin and command builtins (see Bash Builtins).
command builtin allows selective disabling of functions
when command lookup is performed (see Bash Builtins).
enable
builtin (see Bash Builtins).
exec builtin takes additional options that allow users
to control the contents of the environment passed to the executed
command, and what the zeroth argument to the command is to be
(see Bourne Shell Builtins).
export -f (see Shell Functions).
export, readonly, and declare builtins can
take a `-f' option to act on shell functions, a `-p' option to
display variables with various attributes set in a format that can be
used as shell input, a `-n' option to remove various variable
attributes, and `name=value' arguments to set variable attributes
and values simultaneously.
hash builtin allows a name to be associated with
an arbitrary filename, even when that filename cannot be found by
searching the $PATH, using `hash -p'
(see Bourne Shell Builtins).
help builtin for quick reference to shell
facilities (see Bash Builtins).
printf builtin is available to display formatted output
(see Bash Builtins).
read builtin (see Bash Builtins)
will read a line ending in `\' with
the `-r' option, and will use the REPLY variable as a
default if no arguments are supplied. The Bash read builtin
also accepts a prompt string with the `-p' option and will use
Readline to obtain the line when given the `-e' option.
return builtin may be used to abort execution of scripts
executed with the . or source builtins
(see Bourne Shell Builtins).
shopt builtin, for finer control of shell
optional capabilities (see Bash Builtins).
set
builtin (see The Set Builtin).
test builtin (see Bourne Shell Builtins)
is slightly different, as it implements the POSIX algorithm,
which specifies the behavior based on the number of arguments.
trap builtin (see Bourne Shell Builtins)
allows a DEBUG pseudo-signal specification,
similar to EXIT. Commands specified with a DEBUG trap are
executed after every simple command. The DEBUG trap is not
inherited by shell functions.
type builtin is more extensive and gives more information
about the names it finds (see Bash Builtins).
umask builtin permits a `-p' option to cause
the output to be displayed in the form of a umask command
that may be reused as input (see Bourne Shell Builtins).
csh-like directory stack, and provides the
pushd, popd, and dirs builtins to manipulate it
(see The Directory Stack).
Bash also makes the directory stack visible as the value of the
DIRSTACK shell variable.
disown builtin can remove a job from the internal shell
job table (see Job Control Builtins) or suppress the sending
of SIGHUP to a job when the shell exits as the result of a
SIGHUP.
mldmode and priv) not present in Bash.
stop or newgrp builtins.
SHACCT variable or perform shell accounting.
sh uses a TIMEOUT variable like Bash uses
TMOUT.
More features unique to Bash may be found in Bash Features.
Since Bash is a completely new implementation, it does not suffer from many of the limitations of the SVR4.2 shell. For instance:
if or while
statement.
EOF under certain circumstances.
This can be the cause of some hard-to-find errors.
SIGSEGV. If the shell is started from a process with
SIGSEGV blocked (e.g., by using the system() C library
function call), it misbehaves badly.
-p' option, will alter its real
and effective UID and GID if they are less than some
magic threshold value, commonly 100.
This can lead to unexpected results.
SIGSEGV,
SIGALRM, or SIGCHLD.
IFS, MAILCHECK,
PATH, PS1, or PS2 variables to be unset.
^' as the undocumented equivalent of
`|'.
-x -v);
the SVR4.2 shell allows only one option argument (-xv). In
fact, some versions of the shell dump core if the second argument begins
with a `-'.
jsh
(it turns on job control).