Bash Reference Manual

      Taken from man pages but reworded, rearranged and examples to make it so even I can see how to do something with bash!

  • What is a shell? , What is Bash?
  • Definitions

  • Basic Features
  • Syntax
  • Operation
  • Quoting
  • Comments #
  • Commands
  • Functions
  • Parameters
  • Expansions
  • Redirecting I/O
  • STDIN cmd < f
  • STDOUT cmd > f Appending Output >>
  • STDERR with STDOUT  >f 2>&1 
  • Here Documents << stop
  • Duplicating File Descriptors
  • Opening File Descriptors for Reading and Writing
  • Executing Commands
  • Scripts
  • Features
  • Bash Features
  • Job Control
  • Using History Interactively
  • Command Line Editing
  • Builtin Commands
  • Reserved Words
  • Parameter and Variable
  • Functions
  • Concepts

  • Builtin Commands

    . : [ alias bg bind break builtin cd command continue declare dirs disown echo enable eval exec exit export fc fg getopts hash help history jobs kill let local logout popd printf pushd pwd read readonly return set shift shopt source suspend test times trap type typeset ulimit umask unalias unset wait

    Reserved Words

     !  case esac [[ ]] if then elif else fi
    while for do done { } in until select time function

    Installing Bash
    Basic Installation Compilers and Options Compiling For Multiple Architectures Installation Names
    Specifying the System Type Sharing Defaults Operation Controls Optional Features

    DGG made this nice stuff from, what is now, and old version of the docs.

    The truth is out there
    GNU bash, version 3.2.25(1)-release-(i686-redhat-linux-gnu)
    sh [GNU long option] [option] script-file ...
    --debug          --debugger          --dump-po-strings   --dump-strings
    --help           --init-file         --login             --noediting
    --noprofile      --norc              --posix             --protected
    --rcfile         --rpm-requires      --restricted        --verbose
    --version        --wordexp
    Shell options:
    -irsD or -c command or -O shopt_option      (invocation only)
    -abefhkmnptuvxBCHP or -o option
    following rearranged, i.e. not exactly as displayed
    > sh -c "help set"  
    set: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
    -o option-name
    Set the variable corresponding to option-name:
       allexport    -a Mark variables which are modified or created for export.
       braceexpand  -B the shell will perform brace expansion
       errexit      -e Exit immediately if a command exits with a non-zero status.
       errtrace     -E ERR trap is inherited by shell functions.
       functrace    -T If set, the DEBUG trap is inherited by shell functions.
       hashall      -h Remember the location of commands as they are looked up.
       history          enable command history
       histexpand   -H Enable ! style history substitution.  default on  when shell is interactive.
       ignoreeof        the shell will not exit upon reading EOF
       keyword      -k All assignment arguments are placed in the environment for a command, 
                        not just those that precede the command name.
       noclobber    -C disallow existing regular files to be overwritten by redirection of output.
       noglob       -f Disable file name generation (globbing).
       monitor      -m  Job control is enabled.
       notify       -b Notify of job termination immediately.
       nounset      -u Treat unset variables as an error when substituting.
       onecmd       -t Exit after reading and executing one command.
       physical     -P do not follow symbolic links when executing commands such as 
                        cd which change the current directory.
       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
       privilege   -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.
       vi             use a vi-style line editing interface
       emacs          use an emacs-style line editing interface
       noexec      -n Read commands but do not execute them.
       verbose     -v display shell input lines as they are read.
       xtrace      -x display commands and arguments as they are executed.
       posix            operate as 1003.2 standard 
       interactive-comments allow comments to appear in interactive commands
       -   Assign any remaining arguments to the positional parameters.
       The -x and -v options are turned off.
    Using + rather than - causes flags to be turned off.  
    The flags can be used at invocation of the shell.  
    The current set of flags may be found in $-.    echo $- himBH  (hashall, jobcontrol, Braceexpand, HistExpand )
    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.

    Type `sh -c help' for more information about shell builtin commands.

    cygwin 2.05b.0(8)-release BASH_VERSION=1.14.7(1)

    This document was (taken from a document) generated on 7 November 1998 using the texi2html translator version 1.52.

    And severly hacked by Dennis G German 12/18/01