Naar inhoud springen

Gebruiker:Klaas van Buiten/Bourne again shell

Uit Wikipedia, de vrije encyclopedie
Bourne again shell

Bash Features[bewerken | brontekst bewerken]

This text is a brief description of the features that are present in the Bash shell (version 3.2, 28 September 2006).

  This is Edition 3.2, last updated 28 September 2006, of `The GNU

Bash Reference Manual', for `Bash', Version 3.2.

  Bash contains features that appear in other popular shells, and some

features that only appear in Bash. Some of the shells that Bash has borrowed concepts from are the Bourne Shell (`sh'), the Korn Shell (`ksh'), and the C-shell (`csh' and its successor, `tcsh'). The following menu breaks the features up into categories based upon which one of these other shells inspired the feature.

  This manual is meant as a brief introduction to features found in

Bash. The Bash manual page should be used as the definitive reference on shell behavior.

GNU bash, version 3.2.48(1)-release-(x86_64-apple-darwin10.0) Usage: bash [GNU long option] [option] ... bash [GNU long option] [option] script-file ... GNU long options: --debug --debugger --dump-po-strings --dump-strings --help --init-file --login --noediting --noprofile --norc --posix --protected --rcfile --restricted --verbose --version --wordexp Shell options: -irsD or -c command or -O shopt_option (invocation only) -abefhkmnptuvxBCHP or -o option Type `bash -c "help set"' for more information about shell options. Type `bash -c help' for more information about shell builtin commands. Use the `bashbug' command to report bugs.

bash -c help GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) These shell commands are defined internally. Type `help' to see this list. Type `help name' to find out more about the function `name'. Use `info bash' to find out more about the shell in general. Use `man -k' or `info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

JOB_SPEC [&]                       (( expression ))
. filename [arguments]             :
[ arg... ]                         expression 
alias [-p] [name[=value] ... ]     bg [job_spec ...]
bind [-lpvsPVS] [-m keymap] [-f fi break [n]
builtin [shell-builtin [arg ...]]  caller [EXPR]
case WORD in [PATTERN [| PATTERN]. cd [-L|-P] [dir]
command [-pVv] command [arg ...]   compgen [-abcdefgjksuv] [-o option
complete [-abcdefgjksuv] [-pr] [-o continue [n]
declare [-afFirtx] [-p] [name[=val dirs [-clpv] [+N] [-N]
disown [-h] [-ar] [jobspec ...]    echo [-neE] [arg ...]
enable [-pnds] [-a] [-f filename]  eval [arg ...]
exec [-cl] [-a name] file [redirec exit [n]
export [-nf] [name[=value] ...] or false
fc [-e ename] [-nlr] [first] [last fg [job_spec]
for NAME [in WORDS ... ;] do COMMA for (( exp1; exp2; exp3 )); do COM
function NAME { COMMANDS ; } or NA getopts optstring name [arg]
hash [-lr] [-p pathname] [-dt] [na help [-s] [pattern ...]
history [-c] [-d offset] [n] or hi if COMMANDS; then COMMANDS; [ elif
jobs [-lnprs] [jobspec ...] or job kill [-s sigspec | -n signum | -si
let arg [arg ...]                  local name[=value] ...
logout                             popd [+N | -N] [-n]
printf [-v var] format [arguments] pushd [dir | +N | -N] [-n]
pwd [-LP]                          read [-ers] [-u fd] [-t timeout] [
readonly [-af] [name[=value] ...]  return [n]
select NAME [in WORDS ... ;] do CO set [--abefhkmnptuvxBCHP] [-o opti
shift [n]                          shopt [-pqsu] [-o long-option] opt
source filename [arguments]        suspend [-f]
test [expr]                        time [-p] PIPELINE
times                              trap [-lp] [arg signal_spec ...]
true                               type [-afptP] name [name ...]
typeset [-afFirtx] [-p] name[=valu ulimit [-SHacdfilmnpqstuvx] [limit
umask [-p] [-S] [mode]             unalias [-a] name [name ...]
unset [-f] [-v] [name ...]         until COMMANDS; do COMMANDS; done
variables - Some variable names an wait [n]
while COMMANDS; do COMMANDS; done  { COMMANDS ; }

bash -c "help set" set: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]

       -a  Mark variables which are modified or created for export.
       -b  Notify of job termination immediately.
       -e  Exit immediately if a command exits with a non-zero status.
       -f  Disable file name generation (globbing).
       -h  Remember the location of commands as they are looked up.
       -k  All assignment arguments are placed in the environment for a
           command, not just those that precede the command name.
       -m  Job control is enabled.
       -n  Read commands but do not execute them.
       -o option-name
           Set the variable corresponding to option-name:
               allexport    same as -a
               braceexpand  same as -B
               emacs        use an emacs-style line editing interface
               errexit      same as -e
               errtrace     same as -E
               functrace    same as -T
               hashall      same as -h
               histexpand   same as -H
               history      enable command history
               ignoreeof    the shell will not exit upon reading EOF
               interactive-comments
                            allow comments to appear in interactive commands
               keyword      same as -k
               monitor      same as -m
               noclobber    same as -C
               noexec       same as -n
               noglob       same as -f
               nolog        currently accepted but ignored
               notify       same as -b
               nounset      same as -u
               onecmd       same as -t
               physical     same as -P
               pipefail     the return value of a pipeline is the status of
                            the last command to exit with a non-zero status,
                            or zero if no command exited with a non-zero status
               posix        change the behavior of bash where the default
                            operation differs from the 1003.2 standard to
                            match the standard
               privileged   same as -p
               verbose      same as -v
               vi           use a vi-style line editing interface
               xtrace       same as -x
       -p  Turned on whenever the real and effective user ids do not match.
           Disables processing of the $ENV file and importing of shell
           functions.  Turning this option off causes the effective uid and
           gid to be set to the real uid and gid.
       -t  Exit after reading and executing one command.
       -u  Treat unset variables as an error when substituting.
       -v  Print shell input lines as they are read.
       -x  Print commands and their arguments as they are executed.
       -B  the shell will perform brace expansion
       -C  If set, disallow existing regular files to be overwritten
           by redirection of output.
       -E  If set, the ERR trap is inherited by shell functions.
       -H  Enable ! style history substitution.  This flag is on
           by default when the shell is interactive.
       -P  If set, do not follow symbolic links when executing commands
           such as cd which change the current directory.
       -T  If set, the DEBUG trap is inherited by shell functions.
       -   Assign any remaining arguments to the positional parameters.
           The -x and -v options are turned off.
   
   Using + rather than - causes these flags to be turned off.  The
   flags can also be used upon invocation of the shell.  The current
   set of flags may be found in $-.  The remaining n ARGs are positional
   parameters and are assigned, in order, to $1, $2, .. $n.  If no
   ARGs are given, all shell variables are printed.

Introduction[bewerken | brontekst bewerken]

What is Bash?[bewerken | brontekst bewerken]

Bash is the shell, or command language interpreter, for the GNU operating system. The name is an acronym for the `Bourne-Again SHell', a pun on Stephen Bourne, the author of the direct ancestor of the current Unix shell `sh', which appeared in the Seventh Edition Bell Labs Research version of Unix.

  Bash is largely compatible with `sh' and incorporates useful

features from the Korn shell `ksh' and the C shell `csh'. It is intended to be a conformant implementation of the IEEE POSIX Shell and Tools portion of the IEEE POSIX specification (IEEE Standard 1003.1). It offers functional improvements over `sh' for both interactive and programming use.

  While the GNU operating system provides other shells, including a

version of `csh', Bash is the default shell. Like other GNU software, Bash is quite portable. It currently runs on nearly every version of Unix and a few other operating systems - independently-supported ports exist for MS-DOS, OS/2, and Windows platforms.

What is a shell?[bewerken | brontekst bewerken]

At its base, a shell is simply a macro processor that executes commands. The term macro processor means functionality where text and symbols are expanded to create larger expressions.