Next Previous Contents

3. Differences from other Unix shells

3.1 How does bash differ from sh, the Bourne shell?

This is a non-comprehensive list of features that differentiate bash from the SVR4.2 shell. The bash manual page explains these more completely.

Things bash has that sh does not:


        expansions to perform substring removal (${p%[%]w}, ${p#[#]w})
        expansion of positional parameters beyond $9 with ${num}
        variables: BASH, BASH_VERSION, BASH_VERSINFO, UID, EUID, REPLY,
                   TIMEFORMAT, PPID, PWD, OLDPWD, SHLVL, RANDOM, SECONDS,
                   LINENO, HISTCMD, HOSTTYPE, OSTYPE, MACHTYPE, HOSTNAME,
                   ENV, PS3, PS4, DIRSTACK, PIPESTATUS, HISTSIZE, HISTFILE,
                   HISTFILESIZE, HISTCONTROL, HISTIGNORE, GLOBIGNORE, GROUPS,
                   PROMPT_COMMAND, FCEDIT, FIGNORE, IGNOREEOF, INPUTRC,
                   SHELLOPTS, OPTERR, HOSTFILE, TMOUT, FUNCNAME, histchars,
                   auto_resume

Things sh has that bash does not: uses variable SHACCT to do shell accounting includes `stop' builtin (bash can use alias stop='kill -s STOP') `newgrp' builtin turns on job control if called as `jsh' $TIMEOUT (like bash $TMOUT) `^' is a synonym for `|' new SVR4.2 sh builtins: mldmode, priv

Implementation differences:

3.2 How does bash differ from the Korn shell, version ksh88?

Things bash has or uses that ksh88 does not:


 BASH, BASH_VERSION, BASH_VERSINFO, UID, EUID, SHLVL,
                   TIMEFORMAT, HISTCMD, HOSTTYPE, OSTYPE, MACHTYPE,
                   HISTFILESIZE, HISTIGNORE, HISTCONTROL, PROMPT_COMMAND,
                   IGNOREEOF, FIGNORE, INPUTRC, HOSTFILE, DIRSTACK,
                   PIPESTATUS, HOSTNAME, OPTERR, SHELLOPTS, GLOBIGNORE,
                   GROUPS, FUNCNAME, histchars, auto_resume

Things ksh88 has or uses that bash does not:

Implementation differences:

3.3 Which new features in ksh-93 are not in bash, and which are?

New things in ksh-93 not in bash-2.04:

New things in ksh-93 present in bash-2.04:


        for (( expr1; expr2; expr3 )) ; do list; done - arithmetic for command
        ?:, ++, --, `expr1 , expr2' arithmetic operators
        expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]},
                    ${!param*}
        compound array assignment
        the `!' reserved word
        loadable builtins -- but ksh uses `builtin' while bash uses `enable'
        `command', `builtin', `disown' builtins
        new $'...' and $"..." quoting
        FIGNORE (but bash uses GLOBIGNORE), HISTCMD
        set -o notify/-C
        changes to kill builtin
        read -A (bash uses read -a)
        read -t/-d
        trap -p
        exec -c/-a
        `.' restores the positional parameters when it completes
        POSIX.2 `test'
        umask -S
        unalias -a
        command and arithmetic substitution performed on PS1, PS4, and ENV
        command name completion
        ENV processed only for interactive shells


Next Previous Contents