Available in

(1) (1)/es (1)/fr (1)/it (1)/ja (1)/ko (1)/nl (1)/pl (1)/zh_CN (1)/zh_TW

TOC

BASH(1)                                                                BASH(1)



bash - GNU Bourne-Again SHell

bash

       [options] [file]

Bash is Copyright (C) 1989-2001 by the Free Software Foundation, Inc.

bash

       sh bash Korn  C  (ksh  csh)


       bash
        IEEE POSIX Shell and Tools specification (IEEE Working Group 1003.2)


bash

       ( set 1 ):

       -c string -c

                 string

                 string

                  (positional parameter: $0 )
       -r        -r

                 bash

                 (restricted)
                  ( )
       -i        -i

                 bash

                 (interactive)

       -s        -s






       -D         (double-quoted strings) $
                  C  POSIX


                  -n

       --        --

                 --


                 -

                 --


       bash



       1

       --dump-po-strings
              -D
               GNU gettext po ()
       --dump-strings
              -D
       --help
       --init-file file
       --rcfile file


              ~/.bashrc

              file
               ( )

       --login
               ( )

              bash


       --noediting
               GNU readline


       --noprofile

              /etc/profile

              ~/.bash_profile, ~/.bash_login, ~/.profile

              bash

               ( )

       --norc  ~/.bashrc

              sh


       --posix
              bash
               POSIX 1003.2
               (posix )

       --restricted
               ( )

       --verbose
              -v

       --version

              bash



-c

       -s




       bash

       $0

       () bash

       bash

        0

(login shell)0
       -

       --login




        ( isatty(3) ) -c

       -i

       bash

       PS1

       $-

       i





       bash



       bash






       bash

       --login /etc/profile bash


       bash
        ~/.bash_profile, ~/.bash_login, ~/.profile

       bash


       --noprofile




       ~/.bash_logout bash



       ~/.bashrc bash


       --norc

       --rcfile file
        ~/.bashrc file

       () bash

       BASH_ENV




       bash :
              if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi

       PATH


       sh

       bash

       bash

       sh

        POSIX

        --login

       /etc/profile

       ~/.profile

       --noprofile

       sh

       bash

       ENV


       sh


       --rcfile

       sh


       sh

       bash

       POSIX


       --posix

       bash

       POSIX

       bash
        POSIX

       ENV




       bash
        ( rshd)

       rshd bash

       ~/.bashrc bash

       sh --norc

       --rcfile

        rshd



        () ID  () ID
        -p

       SHELLOPTS
        ID  ID -p

        ID




       (blank)

       (word)  1 (token)

       (name)

              (identifier)

       (metacharacter)

              :
              |  & ; ( ) < >

       :
              || & && ; ;; ( ) | <newline>

 (reserved word)
        (simple command)
        ( ) case

       for
        3 :

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


   (Simple Commands)
        (simple command)
        ()






       n
        128+n

   (Pipeline)
        (pipeline) |
        1 :

              [time [-p]] [ ! ] command [ | command2 ... ]

       command

       command2



       ( )


       !


       NOT





       time


       -p
        POSIX

       TIMEFORMAT

        (

       TIMEFORMAT )


       ()


        (list) 1
       ;, &, &&, ||

       ;, &, <newline>
        ()


       &&

       ||

       ;

       &



       &

        (background)
        0

       ;





       &&
        AND ||
        OR AND

              command1 && command2


       command1
        0 command2


       OR

              command1 || command2



       command1
        0 command2 AND  OR


   (Compound Commands)
        (compound command) :

       (list) list


               list

       { list; }
              list list (group command) list

       ((expression))
              expression

               0  0
               1  let "expression"


       [[ expression ]]
               expression  0  1



               [[  ]]




              ==  !=


               0
               1



              :

              ( expression )
                     expression

              ! expression
                     expression

              expression1 && expression2
                     expression1

                     expression2

              expression1 || expression2
                     expression1

                     expression2


       expression1 && ||
        expression2

       for name [ in word ] ; do list ; done
              in
               name list in word for list ( )

              in
               0

       for (( expr1 ; expr2 ; expr3 )) ; do list ; done
              expr1

              expr2 expr2list expr3

               1
               list



       select name [ in word ] ; do list ; done
              in

              in word
               ( ) PS3
               1

              name


              EOF

              name

              REPLY

              break

              return

              list

              select

              list

               0

       case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac
              case  word pattern
               ( )
               list

               0

              list

       if list; then list; [ elif list; then list; ] ... [ else list; ] fi

              if list
               0 then list

               elif list
               0  then list else list
               ()

               0

       while list; do list; done
       until list; do list; done
              while list 0  do list until
               while

              do list

              list

              0 while  until do list
               0

       [ function ] name () { list; }
              name (body) {  }
               name


               ( )

(COMMENTS)

       shopt

       interactive_comments
        ( ) #


       interactive_comments

       interactive_comments


 (quoting)
        (metacharacters)



        (history expansion)  ( !)



       (escape character),
        3

        (\)
        <newline>
        1 \<newline>

       \<newline> ()








       $, `, \

       $

       `


       $, `, ", \, <newline>






       *

       @
        ( )

       $'string'
        string
        ANSI C


       () :
              \a      ()
              \b
              \e
              \f
              \n
              \r
              \t
              \v
              \\
              \'
              \nnn   ASCII  8  nnn  (1  3 )
              \xnnn  ASCII  16  nnn  (1  3 )




       ($)

        C  POSIX



(parameter)


       (variable)




        (set)

       unset
        (unset ) ( )

       :

              name=[value]

       value

       value

        ( )
        (  )$((...))  value
        ( )
        "$@"


   (Positional Parameters)
       (positional parameter) 1  0


       set



        ( )

       2  ({})
        ( )





       *      (1 )


              IFS
               1 "$*"  "$1c$2c..."

              c

              IFS

              IFS

              IFS


       @      (1 )


               "$@"  "$1" "$2" ...  "$@" $@
               ()
       #       10
       ?

       -

              set ( -i )
       $       ID () $
               ID
       !       ()
               ID
       0


              bash

              $0

              -c

              bash

              $0

              bash
               0 $0

       _

               ()






       :
       PPID    ID
       PWD    cd

       OLDPWD cd 1
       REPLY   read

       UID     ID


       EUID    ID


       GROUPS  GROUPS

              GROUPS
               unset

       BASH    bash

       BASH_VERSION

              bash

       BASH_VERSINFO

              bash

              :
              BASH_VERSINFO[0]         ()
              BASH_VERSINFO[1]         ()
              BASH_VERSINFO[2]
              BASH_VERSINFO[3]
              BASH_VERSINFO[4]         (beta1 )
              BASH_VERSINFO[5]        MACHTYPE

       SHLVL  bash
               1

       RANDOM  0  32767 RANDOM

              RANDOM

              unset

              set


       SECONDS

              SECONDS


              SECONDS

              unset

              set


       LINENO
               (1) 10

              LINENO

              unset

              set


       HISTCMD
               () HISTCMD

              unset

              set


       FUNCNAME


              FUNCNAME

              FUNCNAME

              unset

              set


       DIRSTACK
               ( ) dirs




              pushd

              popd


              DIRSTACK

              unset

              set


       PIPESTATUS

               ( )

       OPTARG  getopts
               ( )

       OPTIND  getopts
               ( )

       HOSTNAME


       HOSTTYPE
              bash



       OSTYPE bash



       MACHTYPE
              bash

              GNU  cpu-company-system


       SHELLOPTS


              set

              -o
               ( ) SHELLOPTS set -o on


              bash




       COMP_WORDS

              (  )
               (  )


       COMP_CWORD

              ${COMP_WORDS}
               (  )


       COMP_LINE

               (  )


       COMP_POINT



               ${#COMP_LINE}
               (  )



       bash


       IFS    (Internal Field Separator)

              read

               ``<><><>''
       PATH

              ( ) bash


              ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.''

       HOME
               cd

       CDPATH cd

              cd


              ``.:~:/usr''
       BASH_ENV
              bash

              (~/.bashrc )

              BASH_ENV



              PATH

       MAIL    MAILPATH

              bash

       MAILCHECK
              bash
               ()
               60


               unset
               0

       MAILPATH


              `?'

              $_ :
              MAILPATH='/var/mail/bfox?"You  have  mail":~/shell-mail?"$_  has
              mail!"'

              bash

              bash

              (/var/mail/$USER )
       PS1     ( )
               ``\s-\v\$ ''
       PS2     PS1

               ``> ''
       PS3     select
               ( )
       PS4     PS1

              bash

               (levels of indirection) PS4

               ``+ ''
       TIMEFORMAT

              time


              %


               ([])

              %%        %
              %[p][l]R
              %[p][l]U   CPU
              %[p][l]S   CPU
              %P        CPU (%U + %S) / %R

              p  (precision)
               0

               3 p  3  3 p  3

              l MMmSS.FF
               p

               bash $'\nreal\t%3lR\nuser\t%3lU\nsys%3lS'




       HISTSIZE
               ( HISTORY )

       HISTFILE
               ( ) ~/.bash_history



       HISTFILESIZE


               500


       OPTERR  1 bash

              getopts ( )

              OPTERR
               1

       LANG   LC_


       LC_ALL  LC_  LANG


       LC_COLLATE




       LC_CTYPE



       LC_MESSAGES
              $


       LC_NUMERIC


       LINES   select

              SIGWINCH

       COLUMNS

              select

              SIGWINCH PROMPT_COMMAND



       IGNOREEOF

              EOF


              EOF

              bash

               10

              EOF


       TMOUT  0


              bash


       FCEDIT  fc


       FIGNORE
               ( READLINE )

              FIGNORE



              ``.o:~''

       GLOBIGNORE



              GLOBIGNORE



       INPUTRC
              readline

              ~/.inputrc ( READLINE )

       HISTCONTROL
              ignorespace


              ignoredups


              ignoreboth
               2


              HISTIGNORE


              HISTIGNORE


              2 HISTCONTROL


       HISTIGNORE




              (`*' ) HISTCONTROL


              `&'
               `&'

              2

              HISTIGNORE


       histchars
              2  3
               ( )
                (history expansion)
               `!'  2   (quick substitution)


               `^' 3

               `#'





       HOSTFILE
              /etc/hosts




              bash

              HOSTFILE

              bash /etc/hosts

              HOSTFILE
               unset

       auto_resume

              1







              exact



              substring



              substring

              %?
               ( )


              %


       COMPREPLY
              bash
               (  )


   bash
        1

       declare




        0

        name[subscript]=value

       subscript

       0

       declare -a name
        ( ) declare -a name[subscript] subscript

       declare

       readonly




       name=(value1 ... valuen)
        (compound assignment)

       value  [subscript]=string
        string ([])


        1
        0

       declare

       name[subscript]=value

       ${name[subscript]}


       (subscript) @  * name

       ${name[*]} 1

       IFS ${name[@]} name ${name[@]}

        *  @  ( )${#name[subscript]} ${name[subscript]} subscript  *  @

        0


       unset unset name[subscript]
        subscript unset name (name ) unset name[subscript] (subscript  *  @)



       declare, local, readonly

       -a

       read

       -a


       set

       declare



()

       7  :    (brace expansion),  (tilde expansion),  (parameter and variable
       expansion),  (command substitution),  (arithmetic  expansion),    (word
       splitting),  (pathname expansion)

       :
        ()

         (process substitution)




       1  1

        "$@"  "${name[@]}"  ( )


        (brace expansion)



        (preamble: )

       (postscript: )








        a{d,c,b}e  `ade ace abe'




       bash




        1


       {  ,

        ${




       :

              mkdir /usr/local/src/bash/{old,new,dist,bugs}

              chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}


       sh

       sh


       bash

       sh
        file{1,2} bash

       file1 file2


       sh

       bash

       +B

       set

       +B

       ( )


        (`~')
       ()
        (tilde-prefix)


        (login name)

       HOME

       HOME






        `~+' PWD

        `~-' OLDPWD
        ()
        N ( `+'  `-' )


       dirs


        `+'  `-' `+'





       :

       =



       PATH, MAILPATH, CDPATH




       `$'
        `}'




       ${parameter}
              parameter parameter
               2 parameter


       parameter (level of variable indirection) bash  parameter parameter

        (indirect expansion)
        ${!prefix*}

       word


       bash


       ${parameter:-word}
               parameter

              word

              parameter

       ${parameter:=word}
               parameter

              word

              parameter

              parameter


       ${parameter:?word}
               parameter word (word

              )


              parameter
       ${parameter:+word}
               parameter


              word

       ${parameter:offset}
       ${parameter:offset:length}

              parameter  length
               offset  length  offset  parameter length  offset  ( ) length  0
              offset  0 parameter parameter  @  offset length parameter  @  *
               ${parameter[offset]} length
               0
               1

       ${!prefix*}
              prefix IFS


       ${#parameter}
              parameter parameter

              *

              @

              parameter

              *

              @


       ${parameter#word}
       ${parameter##word}
              word


              parameter

              parameter
               (``#'')
               (``##'' )

              parameter

              @

              *



              parameter

              @

              *




       ${parameter%word}
       ${parameter%%word}
              word


              parameter

              parameter
               (``%'' )
               (``%%'' )

              parameter

              @

              *



              parameter

              @

              *




       ${parameter/pattern/string}
       ${parameter//pattern/string}
              pattern

              parameter
               pattern string

               string pattern  #  parameter

              pattern  %  parameter

              string  pattern pattern  / parameter

              @

              *


              parameter

              @

              *





        (command substitution)
        2 :


              $(command)

              `command`

       bash command




        $(cat file)
        $(< file)



       $, `, \



       $(command)












       :
              $((expression))

       expression









       expression

       bash



        (process substitution)
        (FIFO) /dev/fd <(list)

       >(list)

        list FIFO  /dev/fd



       >(list)
        list <(list)

       list

        (process substitution)




       ()



       IFS


       IFS

       <><><>

       IFS

       IFS

       (

       )

       IFS
        ( IFS ) IFS

       IFS

       IFS

       IFS

       IFS


       (""
        '')









       -f
       bash

       *, ?, [






       nullglob

       nullglob



       nocaseglob



       ``.''

       dotglob




       ``.''


       nocaseglob, nullglob, dotglob


       shopt



       GLOBIGNORE


       GLOBIGNORE

       GLOBIGNORE



       ``.''

       ``..''

       GLOBIGNORE

       GLOBIGNORE

       dotglob

       ``.''

       ``.''

       ``.*''

       GLOBIGNORE

       GLOBIGNORE

       dotglob





       NUL



       :

       *
       ?       1
       [...]   1 2 (range expresion)
               2
               2
               (collating sequance)

              [

              !

              ^


               ( LC_COLLATE )

              -


              ]


              [

              ]
               (character classes)
               [:class:] class  POSIX.2 :
              alnum alpha ascii blank cntrl  digit  graph  lower  print  punct
              space upper xdigit


              [

              ]
               (equivalence class)
               [=c=]
               c
               (collation weight)

              [

              ] [.symbol.]  symbol

        shopt extglob

       pattern-list |  1
        1


              ?(pattern-list)
                      0  1
              *(pattern-list)
                      0
              +(pattern-list)
                      1
              @(pattern-list)
                      1
              !(pattern-list)




       \,
       ', "












       <
        ( 0)

       >
        ( 1)










              ls > dirlist 2>&1


       dirlist


              ls 2>&1 > dirlist


       dirlist

       dirlist


       bash



              /dev/fd/fd
                     fd  fd
              /dev/stdin
                      0
              /dev/stdout
                      1
              /dev/stderr
                      2
              /dev/tcp/host/port
                     host port bash  TCP
              /dev/udp/host/port
                     host port bash  UDP






       word
       n

       n

       ( 0)

       :

              [n]<word



       word
       n

       n

       ( 1)

        0

       :

              [n]>word


       >

       noclobber

       set word


       >|


       >

       set

       noclobber

       word



       word
       n

       n
        ( 1)


       :

              [n]>>word




        ( 1)
       ( 2) word


        2 :

              &>word

              >&word

       :

              >word 2>&1

   (Here Documents)
       word
        ()




       :

              <<[-]word
                      here-document
              delimiter

       word


       word

       delimiter

       word
        ()

       word



       \<newline>
        ()

       \, $, `

       \



       <<-

       delimiter







              [n]<&word
       word
        1 n


       word


       word

       -

       n

       n

       ( 0)



              [n]>&word


       n

       ( 1) word



       n  word 1





              [n]<>word
       word

       n

       n

        0


(alias)
       alias

       unalias
        ( )







        =



        1 ls

       ls -F

       bash






       alias

       unalias



        ( )


       shopt

       expand_aliases

        (


       shopt )


       bash

        1














       alias








       ()


       #

        0

       FUNCNAME



       DEBUG
        (

       trap )


       local




       return



       #



       declare

       typeset

       -f

       declare

       typeset

       -F




       export

       -f






( let )

        long

       0
        C




       id++ id--
               increment ()/ decrement ()
       ++id --id
               increment () / decrement ()
       - +
       ! ~
       **      ()
       * / %
       + -
       << >>
       <= >= < >

       == !=
       &       AND
       ^       OR
       |       OR
       &&      AND
       ||      OR
       expr?expr:expr

       = *= /= %= += -= <<= >>= &= ^= |=

       expr1 , expr2




        long
        ()




        0  8
        0x  0X  16

       [base#]n  base  2  64 10 n
        9 _, @ base  36

       10  35




 [[  test
       [



       file  /dev/fd/n
        n
        file /dev/stdin/dev/stdout/dev/stderr

       ( /dev/stdin/dev/stdout/dev/stderr
        012 )

       -a file
              file
       -b file
              file
       -c file
              file
       -d file
              file
       -e file
              file
       -f file
              file
       -g file
              file  set-group-id
       -h file
              file
       -k file
              file  ``sticky''

       -p file
              file  (FIFO)
       -r file
              file
       -s file
              file  0
       -t fd   fd

       -u file
              file
               set-user-id
       -w file
              file
       -x file
              file
       -O file
              file  ()
               ID
       -G file
              file  ()
               ID
       -L file
              file
       -S file
              file
       -N file
              file

       file1 -nt file2
              file1  () file2
       file1 -ot file2
              file1  file2
       file1 -ef file2
              file1  file2
               i-
       -o optname

              optname

              set

       -z string
              string  0
       -n string
       string string
               0
       string1 == string2
              ==  =
       string1 != string2
              2
       string1 < string2
              string1  string2

       string1 > string2
              string1  string2

       arg1 OP arg2
              OP

              -eq, -ne, -lt, -le, -gt, -ge


              arg1  arg2


              arg1

              arg2





       1.      ()



       2.



       3.


       4.      =








        0




        0







        0



()









       bash

       PATH

       bash
        (

       hash ) PATH



        127

        1

        0

       ()



        (shell script)





        (


       hash )


       #!





        1

       ()

(execution environment):
       +o
               exec


       +o       (current working directory) cd, pushd, popd


       +o
               umask

       +o      trap

       +o       set


       +o

       +o       () set

       +o      shopt

       +o      alias

       +o      ID $$ $PPID







       +o


       +o

       +o

       +o



       +o




       ()










(environment)
        - =






       (export)

       export

       declare -x








       unset

       export

       declare -x









       -k
        ( set )


       bash

       _



 0
        0 0
        N bash 128+N



        127

        126



       0


        0 ()
        0  ()

       bash

        0
        exit

bash bash

       SIGTERM
        ( kill 0  kill ) SIGINT

       ( wait ) bash SIGQUIT


       bash

       SIGTTIN, SIGTTOU, SIGTSTP


       bash


       SIGINT

       SIGQUIT




       SIGTTIN, SIGTTOU, SIGTSTP



       SIGHUP


       SIGHUP

       SIGCONT

       SIGHUP



       disown ( ) disown -h

       SIGHUP



       huponexit

       shopt

       bash

       SIGHUP



       bash

       bash wait

        wait
        128


(job control)
        (/suspend)
        (/resume)

       bash



       (job)


       jobs

       bash

       ( ) bash :

              [1] 25647

        1
        ID 25647 1 bash





        ID (current terminal process group ID)


       ( ID  ID ) SIGINT


       (foreground)

       (background)

        ID  ID



       ()

       SIGTTIN (SIGTTOU)



       bash


       bash


       ( ^Z, Control-Z) bash

        (delayed suspend)
        ( ^Y, Control-Y)


       bash



       bg

       fg
        kill kill ^Z



       %

       n

       %n





       %ce

       ce

       bash

       %?ce

       ce


       bash

       %%

       %+

        (current job)


        (previous job)

       %- jobs

       +

       -




       %1

       ``fg %1''

        1

       ``%1 &''
        1 ``bg %1''



       bash


       set

       -b

       bash



       bash
        (exit)

       jobs


       bash





bash

       PS1


       PS2

       bash



       :
              \a     ASCII  (07)
              \d     "  "  (: "Tue May 26")
              \e     ASCII  (033)
              \h      `.'
              \H
              \j
              \l      (basename)
              \n
              \r
              \s      $0
                      ()
              \t     24  HH:MM:SS
              \T     12  HH:MM:SS
              \@     12  HH:MM am/pm
              \u
              \v     bash  (: 2.00)
              \V     bash  ( : 2.00.0)
              \w
              \W
              \!
              \#
              \$      UID  0 #

                     $
              \nnn   8 nnn
              \\
              \[

              \]

       :


       ( )




       promptvars (

       shopt )

READLINE

       readline

       --noediting

        emacs vi

       set ( ) +o emacs

       +o vi


   Readline
       emacs
        C-key (: C-n  Control-N )
        M-key M-x  Meta-X ( M-x  ESC x

       x
        ESC
        (meta prefix) M-C-x ESC-Control-x

       x )

       Readline


        (: kill-line)



        (kill)

        ( (yank) )
        (kill ring)
        1



   Readline
        (inputrc ) readline INPUTRC

       ~/.inputrc

       readline

       readline


       # $



       inputrc





              M-Control-u: universal-argument

              C-Meta-u: universal-argument

       inputrc M-C-u  readline universal-argument


       : RUBOUT, DEL, ESC, LFD, NEWLINE, RET, RETURN, SPC, SPACE, TAB

       readline

       (, macro)

   Readline
       inputrc



        2

       ( Meta-  Control- )


       keyname:function-name keyname:macro keyname :

              Control-u: universal-argument
              Meta-Rubout: backward-kill-word
              Control-o: "> output"


       C-u

       universal-argument

       M-DEL

       backward-kill-word


       C-o
        ( ``> output'' )

       "keyseq":function-name "keyseq":macro keyseq

       keyname


       GNU Emacs


              "\C-u": universal-argument
              "\C-x\C-r": re-read-init-file
              "\e[11~": "Function Key 1"


       C-u

       universal-argument

       C-x C-r

       re-read-init-file

       ESC [ 1 1 ~

       Function Key 1 ``Function Key 1''.


       GNU Emacs :
              \C-
              \M-
              \e
              \\
              \"     "
              \'     '

       GNU Emacs :
              \a      ()
              \b
              \d      (delete)
              \f
              \n
              \r
              \t
              \v
              \nnn   ASCII  8  nnn   (1  3 )
              \xnnn  ASCII  16  nnn  (1  3 )






        "  '

       bash

       bind readline

       set

       -o

       ( )

   Readline
       Readline

       inputrc


              set variable-name value


       readline On

       Off

       :

       bell-style (audible)
              readline none readline visible (visible bell) audible readline
       comment-begin (``#'')
              readline insert-comment

               emacs M-# vi #

       completion-ignore-case (Off)
              On readline

       completion-query-items (100)
              possible-completions

               0



       convert-meta (On)
              On readline 8 ASCII 8

              ()
       disable-completion (Off)
              On readline

               self-insert
       editing-mode (emacs)
              readline  emacs vi editing-mode

              emacs

              vi

       enable-keypad (Off)
              On readline

       expand-tilde (Off)
              on readline
       horizontal-scroll-mode (Off)
              on readline 1 1
       input-meta (Off)
              On readline  8 ()

              meta-flag

       isearch-terminators (``C-[C-J'')

              ()

              ESC  C-J
       keymap (emacs)
               readline

              emacs,  emacs-standard,  emacs-meta, emacs-ctlx, vi, vi-command,
              vi-insert vi  vi-command emacs  emacs-standard

              emacs

              editing-mode

       mark-directories (On)
              On

       mark-modified-lines (Off)
              On
               (*)
       output-meta (Off)
              On readline  8

       print-completions-horizontally (Off)
              On readline

       show-all-if-ambiguous (Off)

              On


       visible-stats (Off)
              On stat(2)


   Readline
       Readline C


        4

       $if    $if

              readline



              mode   $if  mode= readline  emacs vi
                      set keymap readline  emacs
                      emacs-standard emacs-ctlx

              term   term=



                     =


                     -

                     sun

                     sun

                     sun-cmd


              application
                     application readline
                      (application name)



                     bash  1 :

                     $if Bash
                     # Quote the current or previous word
                     "\C-xq": "\eb\"\ef\""
                     $endif

       $endif $if

       $else  $if


       $include
               1


              /etc/inputrc :

              $include  /etc/inputrc


       readline
        ( ) (incremental)

       (non-incremental)
        2




       readline



       isearch-terminators

       Control-J Control-G


       Control-S Control-R


       readline






   Readline
        (point)
        (mark) set-mark
        (region)


       beginning-of-line (C-a)

       end-of-line (C-e)

       forward-char (C-f)
              1
       backward-char (C-b)
              1
       forward-word (M-f)
               ()
       backward-word (M-b)

               ()
       clear-screen (C-l)


       redraw-current-line



       accept-line (Newline, Return)

              HISTCONTROL


       previous-history (C-p)

       next-history (C-n)

       beginning-of-history (M-<)

       end-of-history (M->)

       reverse-search-history (C-r)


       forward-search-history (C-s)


       non-incremental-reverse-search-history (M-p)



       non-incremental-forward-search-history (M-n)



       history-search-forward



       history-search-backward



       yank-nth-arg (M-C-y)
               ( 2 )

              n
               n ( 0 )

              n
       yank-last-arg (M-., M-_)

              () yank-nth-arg yank-last-arg


       shell-expand-line (M-C-e)




       history-expand-line (M-^)



       magic-space



       alias-expand-line



       history-and-alias-expand-line

       insert-last-argument (M-., M-_)
              yank-last-arg
       operate-and-get-next (C-o)





       delete-char (C-d)



              delete-char EOF

       backward-delete-char (Rubout)


       forward-backward-delete-char



       quoted-insert (C-q, C-v)

               C-q
       tab-insert (C-v TAB)

       self-insert (a, b, A, 1, !, ...)

       transpose-chars (C-t)



               2

       transpose-words (M-t)



       upcase-word (M-u)
               ()


       downcase-word (M-l)
               ()


       capitalize-word (M-c)
               () ()




       kill-line (C-k)

       backward-kill-line (C-x Rubout)

       unix-line-discard (C-u)

               (kill-ring)
       kill-whole-line

       kill-word (M-d)


               forward-word
       backward-kill-word (M-Rubout)

               backward-word
       unix-word-rubout (C-w)



       delete-horizontal-space (M-\)

       kill-region

       copy-region-as-kill

       copy-backward-word

              backward-word
       copy-forward-word

              forward-word
       yank (C-y)

       yank-pop (M-y)

              yank

              yank-pop



       digit-argument (M-0, M-1, ..., M--)


              M--
       universal-argument

               1 ()


              universal-argument




               4
               1
               4
               16



       complete (TAB)

              bash

               ( $ )
               ( ~ )
               ( @ )
               ()


       possible-completions (M-?)

       insert-completions (M-*)

              possible-completions
       menu-complete
              complete
               1 menu-complete


              (bell-style )

               n  n

               TAB

       delete-char-or-list

              (delete-char ) possible-completions

       complete-filename (M-/)

       possible-filename-completions (C-x /)


       complete-username (M-~)


       possible-username-completions (C-x ~)


       complete-variable (M-$)


       possible-variable-completions (C-x $)


       complete-hostname (M-@)


       possible-hostname-completions (C-x @)


       complete-command (M-!)





       possible-command-completions (C-x !)


       dynamic-complete-history (M-TAB)



       complete-into-braces (M-{)


               ( )


       start-kbd-macro (C-x ()

       end-kbd-macro (C-x ))


       call-last-kbd-macro (C-x e)





       re-read-init-file (C-x C-r)
              inputrc

       abort (C-g)
               ( bell-style )
       do-uppercase-version (M-a, M-b, M-x, ...)
               x

       prefix-meta (ESC)


              ESC f

              Meta-f

       undo (C-_, C-x C-u)


       revert-line (M-r)


              undo

       tilde-expand (M-&)

       set-mark (C-@, M-<space>)



       exchange-point-and-mark (C-x C-x)



       character-search (C-])
               1


       character-search-backward (M-C-])
               1


       insert-comment (M-#)
               readline comment-begin


              comment-begin

       glob-expand-word (C-x *)


       glob-list-expansions (C-x g)
              glob-expand-word


       dump-functions

              readline

               inputrc
       dump-variables
               readline readline

               inputrc
       dump-macros

              readline

               inputrc
       display-shell-version (C-x C-v)

              bash



       complete
        (compspec)


       (complete  )













       bash




       -f

       -d

       FIGNORE



       -G



       GLOBIGNORE

       FIGNORE



       -W

       IFS










        -F -C

       COMP_LINE

       COMP_POINT

       COMP_WORDS

       COMP_CWORD









       -F
        compgen


       COMPREPLY


        -C

        1



       -X

       &
        &


        !


       -P  -S

        readline



       -o dirname

       complete






        bash readline

       -o default

       complete


       readline

(HISTORY)

       -o history

       set

        (command history) ()

        HISTSIZE


       HISTSIZE
        ( 500 )

       ( )


       HISTIGNORE

       HISTCONTROL



       HISTFILE
        ( ~/.bash_history)

       HISTFILE

       HISTFILESIZE


       HISTSIZE

       HISTFILE


       histappend (

       shopt )


       HISTFILE



       HISTFILESIZE

       HISTFILESIZE



       fc ( )

       history







       HISTCONTROL

       HISTIGNORE



       cmdhist




       lithist







       csh
       set

       +H
        ( )










        2


        (event)
        (words)
        (modifier)


        1

        !

        (\)


       shopt



       histverify
        ( shopt ) readline



       readline

       readline

       histreedit

       readline


       history

       -p



       history

       -s

        ()



       (

       histchars )

   (Event Designator)
       !       =, (
       !n     n

       !-n     n

       !!     1 `!-1'
       !string
              string

       !?string[?]
              string

              string
               ?
       ^string1^string2^

              string1

              string2

              ``!!:s/string1/string2/'' ()
       !#

   (Word Designators)
        (word designator)


       :


       ^, $, *, -, %


        0
        1

       0 ()   0
       n      n
       ^       1
       $
       %      `?string?'
       x-y    `0-y'  `-y'
       *      0  `1-$'
               1 *


       x*     x-$
       x-     x*  x-$





   (Modifiers)
        () 1
        `:'

       h       ()
               ()
       t       ()
               ()
       r       .xxx
               (basename)
       e
       p
       q
       x      q


       s/old/new/

              old

              new /


              old

              new

               1 new
               & old

               1  & old

              old


              !?string[?]

              string

       &
       g
               `:s' (:`:gs/old/new/') `:s' /





       -
       --

       : [arguments]

              arguments

               0

        .  filename [arguments]
       source filename [arguments]
              filename

              filename

              filename

              filename

              PATH

              PATH

              bash

              posix

              PATH



              shopt

              sourcepath

              PATH

               arguments filename


              ( 0 ) filename


       alias [-p] [name[=value] ...]
              alias  ( -p ) alias name=value value name value


              value  name

               name alias

       bg [jobspec]
               jobspec

              &

              jobspec
               (current job) bg jobspec
               0

              jobspec

              jobspec


       bind [-m keymap] [-lpsvPSV]
       bind [-m keymap] -x keyseq:shell-command
       bind [-m keymap] [-q function] [-u function] [-r keyseq]
       bind [-m keymap] -f filename
       bind [-m keymap] keyseq:function-name
              readline


              readline

              .inputrc


               '"\C-x\C-r": re-read-init-file' :
              -m keymap

                     keymap

                     keymap emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
                     vi-move, vi-command, vi-insert vi  vi-command
                      emacs  emacs-standard
              -l     readline
              -p     readline

              -P     readline
              -v     readline

              -V     readline
              -s     readline


              -S     readline

              -f filename
                      filename
              -q function
                      function
              -u function
                      function

              -r keyseq
                     keyseq
              -x keyseq:shell-command
                     keyseq shell-command


               0

       break [n]
              for, while, until, select n n break n
               1 n

              break

               0

       builtin shell-builtin [arguments]

              arguments




              cd shell-builtin


       cd [-LP] [dir]
               dir

              HOME

              dir

              CDPATH

              dir

              CDPATH
               (:) CDPATH

              ( ``.'')  dir
               (/) CDPATH

              -P

               ( set

              -P ) -L


              -

              $OLDPWD




       command [-pVv] command [arg ...]
              command

              args


              PATH

              -p

              command

              PATH


              -V

              -v

              command

              -v

              command

              -V

              -V

              -v

              command
               0  1

              command
               127

              command

              command


       compgen [option] [word]
              option word
               complete -p  -r

              -F  -C





              word word





       complete  [-abcdefjkvu]  [-o  comp-option] [-A action] [-G globpat] [-W
       wordlist] [-P prefix] [-S suffix]
              [-X filterpat] [-F function] [-C command] name [name ...]
       complete -pr [name ...]
              name -p

               () -r  name name



              .sp 1

              -G, -W, -X  ( -P  -S ) complete

              -o comp-option
                      comp-option


                      comp-option

                      default  readline
                      dirnames


                      filenames
                               readline readline ()


              -A action
                      action

                      alias   -a
                      arrayvar

                      binding readline
                      builtin -b
                      command -c
                      directory
                              -d
                      disabled

                      enabled
                      export   -e
                      file    -f
                      function

                      helptopic
                              help
                      hostname
                              HOSTFILE

                      job     -j
                      keyword -k
                      running
                      setopt  set  -o
                      shopt   shopt
                      signal
                      stopped
                      user    -u
                      variable
                              -v
              -G globpat
                       globpat

              -W wordlist
                      wordlist IFS




              -C command
                      command

              -F function
                       function

                      COMPREPLY

              -X filterpat
                      filterpat

                      filterpat filterpat  !  filterpat
              -P prefix

                      prefix
              -S suffix

                      prefix

              -p  -r name
               name


       continue [n]
              for, while, until, select

              n
               n n
               1 n

               () continue

               0

       declare [-afFirx] [-p] [name[=value]]
       typeset [-afFirx] [-p] [name[=value]]

              name -p

              name

              -p

              -F


              -F

              -f


              :
              -a     name  ( )
              -f
              -i      ( )
              -r     name
                      unset
              -x     name


              `-'  `+' +a

              local
               name
               0 ``-f foo=bar''


               ( )name

               -f

       dirs [-clpv] [+n] [-n]



              1 pushd

              popd

              +n      dirs

                      n
                      0
              -n      dirs

                      n
                      0
              -c
              -l


              -p     1  1
              -v     1  1



              n
               0

       disown [-ar] [-h] [jobspec ...]

              jobspec

              -h jobspec


              SIGHUP

              SIGHUP

              jobspec

              -a

              -r jobspec

              -a



              jobspec

              -r


              jobspec
               0

       echo [-neE] [arg ...]
              arg
               0 -n -e

              -E



              xpg_echo echo

              echo

              --

              echo :
              \a     ()
              \b
              \c
              \e
              \f
              \n
              \r
              \t
              \v
              \\
              \nnn   ASCII  8  nnn  (1  3 )
              \xnnn  ASCII  16  nnn  (1  3 )

       enable [-adnps] [-f filename] [name ...]
              /




              -n  name name

              PATH

              test

              ``enable -n test''.

              -f

              name

              filename


              -d

              -f

               name -p




              -n -a

              -s POSIX name


               0

       eval [arg ...]
              arg  1


              eval

              args

              eval
               0

       exec [-cl] [-a name] [command [arguments]]
              command


              arguments
               command -l

              command
               0

              login(1)

              -c

              command

              -a
               0 name

              command


              execfail


              command

               0
               1

       exit [n]
               n n



              EXIT


       export [-fn] [name[=word]] ...
       export -p

              name



              -f

              name

              name

              -p


              -n


              name

              -f

              export
               0

       fc [-e ename] [-nlr] [first] [last]
       fc -s [pat=rep] [cmd]
               (Fix Command)

              first

              last

              first

              last
               ()
               ( )

              last

              ( ``fc -l -10''
               10 ) first

              first

               -16

              -n

              -r

              -l


              ename

              ename

              FCEDIT

              FCEDIT

              EDITOR


              vi



              2 pat  rep command

              ``r=fc -s''


              ``r cc''

              ``cc''

              ``r''



              first

              last
               0 -e



              2


              cmd

              fc


       fg [jobspec]
              jobspec

              jobspec



              jobspec

              jobspec


       getopts optstring name [args]
              getopts

              optstring






              getopts

              name

              (name )

              OPTIND

              OPTIND
               1

              getopts

              OPTARG


              OPTIND

              1 getopts



              getopts  0 OPTIND name  ?

              getopts

              args

              getopts


              getopts
               2 optstring

              (silent)




              OPTERR
               0

              optstring



              getopts
               ?  name


              OPTARG

              getopts

              OPTARG



              getopts
               (?) name

              OPTARG

              getopts
               (:) name

              OPTARG


              () getopts


              getopts


       hash [-r] [-p filename] [name]
              name

              $PATH


              -p

              filename

              -r



              name



       help [-s] [pattern]

              pattern

              help

              pattern



              -s pattern
               0

       history [n]
       history -c
       history -d offset
       history -anrw [filename]
       history -p arg [arg ...]
       history -s arg [arg ...]

              *


              n

              n

              filename


              HISTFILE () :
              -c
              -d offset
                     offset
              -a      (bash )

              -n

                     bash

              -r
              -w
              -p      args



                     arg
              -s     args
                      1

                     args




              -d  offset -p
               0

       jobs [-lnprs] [ jobspec ... ]
       jobs -x command [ args ... ]

              :
              -l      ID
              -p      ID
              -n

              -r
              -s

              jobspec



              jobspec
               0

              -x

              jobs

              command

              args

              jobspec
               ID args

              command


       kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
       kill -l [sigspec | exit_status]
              sigspec

              signum

              pid

              jobspec

              sigspec

              SIGKILL

              signum

              sigspec

              SIG

              sigspec

              SIGTERM


              -l

              -l


               0 -l
               exit_status


               1 kill


              kill


       let arg [arg ...]

              arg
               ( )

              arg
               0 let
               1
               0

       local [option] [name[=value] ...]

              name

              value

              option declare

              local

              name


              local


              local

              local


              name

              name local
               0

       logout

       popd [-n] [+n] [-n]



              cd

              :
              +n     dirs
                      n
                      0 ``popd +0''

                     ``popd +1''
                      2
              -n     dirs
                      n
                      0 ``popd -0''

                     ``popd -1''
                      1
              -n



              popd

              dirs
               0 popd





       printf format [arguments]
              arguments
               format format  3 3 () () ( argument )

              printf(1) %b printf  argument

               %q printf argument

              format
               arguments
               arguments format 0
               0  0

       pushd [-n] [dir]
       pushd [-n] [+n] [-n]





               2 0

              :
              +n     n

                     dirs
                      0
              -n     n

                     dirs
                      0
              -n


              dir    dir



              pushd

              dirs


              dir
               cd pushd
               0 2 pushd
               0





       pwd [-LP]

              -P

              set

              -o physical


              -L



               0

       read  [-ers] [-t timeout] [-a aname] [-p prompt] [-n nchars] [-d delim]
       [name ...]
               1 name 2  2 name


              name

              name


              name

              IFS

               (\)

              :
              -a aname

                     aname
                      0

                     aname

                     name

              -d delim
                     delim
              -e      readline ( READLINE )
              -n nchars
                      read

                      nchars
              -p prompt



              -r



              -s      (silent)
              -t timeout
                      timeout read

                     read


              name

              REPLY

              read  0

       readonly [-apf] [name ...]
               name

              name

              -f name -a

              name

              -p

              -p


               0

              name

              -f

              name


       return [n]

              n

              n



              .  (source)

              n


               .


       set [--abefhkmnptuvxBCHP] [-o option] [arg ...]







              $1, $2, ...  $n

              :
              -a
                       ()

              -b


              -e       ( )  0

                      until

                      while

                      if

                      &&

                      ||


                      !

              -f
              -h

              -k

              -m       ( )



              -n


              -o option-name
                      option-name :
                      allexport
                              -a

                      braceexpand
                              -B

                      emacs   emacs


                              --noediting

                      errexit -e

                      hashall -h

                      histexpand
                              -H

                      history


                      ignoreeof

                              ``IGNOREEOF=10''

                              ( )
                      keyword -k

                      monitor -m

                      noclobber
                              -C

                      noexec  -n

                      noglob  -f

                      notify  -b

                      nounset -u

                      onecmd  -t

                      physical
                              -P

                      posix   bash

                               POSIX 1003.2
                               (posix )
                      privileged
                              -p

                      verbose -v

                      vi      vi
                      xtrace  -x

                      option-name -o

                      option-name +o

                      set

              -p      (privileged)

                      $ENV

                      $BASH_ENV

                      SHELLOPTS

                       () ID
                       () ID
                       -p
                       ID  ID
                       -p
                       ID

                       ID  ID
                       ID   ID
              -t       1
              -u


                      0
              -v
              -x       PS4

              -B       ( )
              -C       bash

                      >, >&, <>


                      >|

                      >

              -H      !


              -P       cd




                      bash


              --

                       arg

                      -


              -
                       arg -x

                      -v

                      arg


              -  +


              $-



       shift [n]
              n+1 ...  $1 ...

              $#  $#-n+1
               unset n
               0  $# n
               0 n 1 n
               $# n

              $#
               0
               0
               0

       shopt [-pqsu] [-o] [optname ...]


              -p



              -p

              :
              -s     optname  ()
              -u     optname  ()
              -q      ()
                      optname
                      optname -q

                      optnames  0 0
              -o     optname set

                     -o


               optname -s

              -u


              shopt
               ()


               optnames  0
               0

              optname
               0

              shopt :

              cdable_vars

                      cd


              cdspell  cd


                      1



              checkhash

                      bash



              checkwinsize
                      bash


                      LINES

                      COLUMNS

              cmdhist  bash



              dotglob  bash
                       `.'
              execfail


                      exec



                      exec

              expand_aliases



              extglob
              histappend

                      HISTFILE


              histreedit

                      readline

              histverify

                      readline


                      readline
              hostcomplete

                      readline bash @ ( READLINE

                      )

              huponexit
                      bash

                      SIGHUP

              interactive_comments

                      #


                      ( )

              lithist  cmdhist

                       ()

              mailwarn
                       bash

                       ``The mail in mailfile has been read''
              no_empty_cmd_completion

                      readline


                      bash
                       PATH
              nocaseglob

                      bash
                       ( )

              nullglob

                      bash
                       ( )
              progcomp

                      ()

              promptvars





              restricted_shell

                       ( )



              shift_verbose

                      shift


              sourcepath
                       source (.)  PATH


              xpg_echo

                       echo

       suspend [-f]
              SIGCONT

              -f



              -f

               0
       test expr
       [ expr ]

              expr
               0  1






              ! expr expr

              ( expr )
                     expr

              expr1 -a expr2
                     expr1

                     expr2

              expr1 -o expr2
                     expr1

                     expr2


              test  [


               0
               1
               2      !  2




               3     2

                      3

                      ! 2  3
                      2
                      ( 3  ) 2  1

                     -a  -o
               4      !
                      3


               5

       times

               0

       trap [-lp] [arg] [sigspec ...]

              sigspec

              arg

              arg

              -


              () arg

              sigspec


              arg

              -p


              sigspec
               trap

              -p

              trap


              sigspec <signal.h> sigspec

              EXIT (0) arg

              sigspec

              DEBUG
               ( ) arg

              -l






              sigspec


              trap


       type [-atp] name [name ...]

              name

              -t

              name


              type

              alias, keyword, function, builtin, file

              name

              -p

              type

              name



              ``type -t name''

              file


              -p


              PATH

              -a

              type

              name

              -p


              -a

              type



       ulimit [-SHacdflmnpstuv [limit]]



              limit

              unlimited

              -H  -S

               (hard)  (soft)


              -H  -S

              limit

              -H

              :
              -a
              -c      (core)
              -d
              -f
              -l
              -m
              -n      ()
              -p     512 ()
              -s
              -t     CPU  ()
              -u     1
              -v

              limit

              (-a )

              -f

               1024 -t

              -p 512 -n

              -u

               0

              unlimited  limit


       umask [-p] [-S] [mode]

              mode

              mode
               10

              chmod(1)

              mode

              -S

               10 -p

              mode


              mode
               0


       unalias [-a] [name ...]
              name -a


              name


       unset [-fv] [name ...]
              name


              -v

              name


              -f

              name



              RANDOM, SECONDS, LINENO, HISTCMD, FUNCNAME, GROUPS, DIRSTACK


              name



       wait [n]
               wait n
               ID

               wait n
               wait
               0 n

               127

              wait

(RESTRICTED SHELL)

       bash

       rbash

       -r




       bash

       :

       +o      cd

       +o      SHELL, PATH, ENV, BASH_ENV


       +o      /


       +o       .

              /


       +o       hash

              -p

              /


       +o

       +o       SHELLOPTS

       +o       >, >|, <>, >&, &>, >>


       +o       exec


       +o       enable

              -f

              -d


       +o       command

              -p


       +o      set +r  set +o restricted



        ( ) rbash


       Bash Reference Manual, Brian Fox and Chet Ramey
       The Gnu Readline Library, Brian Fox and Chet Ramey
       The Gnu History Library, Brian Fox and Chet Ramey
       Portable  Operating  System  Interface (POSIX) Part 2: Shell and Utili-
       ties, IEEE
       sh(1), ksh(1), csh(1)
       emacs(1), vi(1)
       readline(3)

       /bin/bash
              bash
       /etc/profile

       ~/.bash_profile

       ~/.bashrc

       ~/.bash_logout


       ~/.inputrc
               readline

Brian Fox, Free Software Foundation

       bfox [AT] gnu.org

       Chet Ramey, Case Western Reserve University
       chet [AT] ins.Edu

bash

       bash



       bashbug


       !  bug-bash [AT] gnu.org

       gnu.bash.bug


       :

       bash








              bashbug

               3


       chet [AT] ins.Edu



       bash
       bash

       sh

       POSIX






        `a ; b ; c'







       $(...)



        ()



GNU Bash-2.05                     2001 Mar 5                           BASH(1)

COMMENTS

Add your comment here. Whitespace and linebreaks are preserved. URLs are linked automatically.
CAPTCHA

No HTML allowed. URLs will be linked with nofollow attribute. Whitespace is preserved.