BASH(1) General Commands Manual BASH(1) bash -- GNU Bourne-Again SHell bash [] [_ | ] Bash is Copyright (C) 1989-2022 by the Free Software Foundation, Inc. Bash sh , , . Bash Korn C (ksh csh). Bash IEEE POSIX ( IEEE 1003.1). Bash POSIX. , set, -o, . , bash : -c -c, , , _. _ , ' $0, -- . ' $0 , . -i -i, . -l bash , (. ). -r -r, (. ). -s -s , . . -D , $, . , , C POSIX. -n. . [-+]O [_] _ , shopt (. ). _, -O ; +O . _ , , shopt. +O, , . -- -- . - -- . - --. , bash . , . --debugger , . (. extdebug shopt ). --dump-po-strings -D, GNU gettext po ( '). --dump-strings , -D. --help <<>>. --init-file --rcfile ~/.bashrc, (. ). --login -l. --noediting GNU readline , . --noprofile /etc/profile - ~/.bash_profile, ~/.bash_login ~/.profile. , bash (. ). --norc ~/.bashrc, . , , sh. --posix bash , POSIX , ( posix). . , , posix bash. --restricted (. ). --verbose -v. --version bash <<>>. , -c, -s, , . bash , $0 , . Bash , . bash . , 0. . , PATH. A login shell , -, , --login. , , ( -s), -c, ' ( isatty(3)), , -i. bash , PS1, $- i, . , bash . , , bash . , . bash --login, /etc/profile, . , ~/.bash_profile, ~/.bash_login ~/.profile, . , . --noprofile. exit, bash ~/.bash_logout, . , , bash ~/.bashrc, . --norc. --rcfile bash ~/.bashrc. bash , , , BASH_ENV , , , , , . Bash , : if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi PATH . bash sh, sh, POSIX. --login, /etc/profile ~/.profile, . --noprofile. sh, bash ENV, , , . sh - , --rcfile . , sh, - . sh, bash posix . bash posix --posix, POSIX . ENV, , . - . Bash , , ' ' , , , rshd, sshd. bash , , ~/.bashrc, . , sh. , --norc, --rcfile , , rshd, sshd . () (), -p, , , SHELLOPTS, BASHOPTS, CDPATH GLOBIGNORE, , , . -p, , . . . , . . A , - , . , , identifier. , , , . : | & ; ( ) < > space tab newline , . : || & && ; ;; ;& ;;& ( ) | |& -- , . , , (. ), case select ( in) for ( in do): ! case coproc do done elif else esac fi for function if in select then until while { } time [[ ]] . , . , , . , . 128+n, n. , | |&. : [time [-p]] [ ! ] 1 [ [|||&] 2 ... ] 1 ' 2. ' - , (. ). |&, 1, , ' 2 ; 2>&1 |. - , 1. , pipefail. pipefail, () , , , . !, , . , . time, . -p , POSIX. posix, time , <<->>. TIMEFORMAT , ; . TIMEFORMAT . posix, time . , . TIMEFORMAT . , , , . . , . lastpipe shopt (. shopt ), , . , ;, &, && ||, , , ;, & < >. && || . ; &, . . &, . , 0. . , ;, . , . . && || . . 1 && 2 2 , 1 (). OR 1 || 2 2 , 1 . AND OR . . , . () ( , ). , , . -- . { ; } . . . -- . , ( ), { } , . , . (()) . , 0; 1. , , , . [[ ]] 0 1 . , . [[ ]] . , , , , (, , ). , -f, , . [[, < > . == !=, , , extglob. = ==. nocasematch, . 0, (==) (!=) , 1 . - , . , =~, , as == and !=. , POSIX ( POSIX regcomp regexec, regex(3)). 0, , 1 . , 2. nocasematch, . - , . , - , . , . , . , - . , , , ' ^ $. - BASH_REMATCH , . BASH_REMATCH 0 . , , BASH_REMATCH. BASH_REMATCH n , n- . Bash BASH_REMATCH ; . , : ( ) . . ! True, false. 1 && 2 True, , 1 2, true. 1 || 2 True, 1 2 true. && || 2 , 1 . for [ [ in [ ... ] ] ; ] do ; done , in, . , . in, for (. ). . in , , 0. for (( 1 ; 2 ; 3 )) ; do ; done , 1 , . , expr2 . , 2 , 3. , , 1. , , false, - . select [ in ] ; do ; done in . . , . in, (. ). select PS3 . , , . , . (EOF), select 1. - , (null). REPLY. , break. select , , , . case in [ [(] [ | ] ... ) ;; ] ... esac case , . , , , , . , , , , . nocasematch, . , . ;;, . ;& ;;, ' . ;;& ;;, , , - ' , , , . , . , . if ; then ; [ elif ; then ; ] ... [ else ; ] fi if . -- then . elif , , then . else , . , . while -1; do -2; done until -1; do -2; done while -2, -1 . until while, : -2 , -1 . while until -2 , . -- , coproc. , &. , , , . : coproc [] [] . , (. ). . , COPROC. : coproc { []; } , ' COPROC, , . , '. coproc , : , , . , ; , . - (. ) , . ' , , [0]. ' , , [1]. - , (. ). . , , . , , _PID. wait. , coproc . . , . : fname () _ [] function _ [()] _ [] _. function '. function, '. _ (. ). , , { }, - , function, , . _ , _. posix _ POSIX. - , $. (. ), , . , . . (. .) , shopt interactive_comments (. ), #, . interactive_comments . interactive_comments . . , . -- , . (. ), , !, . : , . (\) . , < >. \< > \< > (, , , ). . , . , , , $, `, \ , , !. posix, ! , . $ ` . , : $, `, ", \ < >. . , !, . ! . * @ (. ). $'' , . , , ANSI C. , , : \a () \b backspace \e \E \f \n \r \t \v \\ \' \" \? \nnn , nnn ( ) \xHH , HH ( ) \uHHHH Unicode (ISO/IEC 10646), HHHH ( ) \UHHHHHHHH Unicode (ISO/IEC 10646), HHHHHHHH ( ) \cx control-x , , . , ($"") , . gettext LC_MESSAGES TEXTDOMAIN. C POSIX, , . , , . noexpand_translation shopt, , . . shopt . , . , , . , . , . declare (. declare ). , . . , unset (. ). =[] , . , , , (. ). integer, , $((...)) (. ). . alias, declare, typeset, export, readonly local ( ). posix ' . , , += . , declare, ( ). += , integer , , . += - (. ), ( =), , , ( ), - . . nameref -n declare local (. declare local ) nameref . . nameref, , ( nameref) , nameref. nameref , . , , declare -n ref=$1 nameref ref, , . , , , $1. for nameref, , . - nameref. nameref - -. nameref -n unset. , unset nameref , nameref. -- , , 0. . set. . (. ). , , (. ). . . . * , . , . . , , , IFS. , "$*" "$1c$2c...", c -- IFS. IFS , . IFS , ' . @ , . , . , . , , , . , . , "$@" "$1" "$2" ... , ' , ' . , "$@" $@ (, ). # . ? . - , , set, ( -i). $ . , . ! , , bg (. JOB CONTROL ). 0 . . bash , $0 . bash -c, $0 , . , , bash, . : _ , , , , , . , , , . , , , . , . BASH , bash. BASHOPTS . -s shopt (. ). , ' BASHOPTS, , shopt , . , bash - . . BASHPID bash. , , , bash, $$. BASHPID . BASHPID, , . BASH_ALIASES - , , alias. , , ; . BASH_ALIASES, , . BASH_ARGC -, bash. ( , . source) . , BASH_ARGC. BASH_ARGC (. extdebug shopt). extdebug , , , extdebug , . BASH_ARGV -, bash. ; - . , BASH_ARGV. BASH_ARGV (. extdebug shopt). extdebug , , , extdebug , . BASH_ARGV0 ( $0; . 0 ). BASH_ARGV0 $0. BASH_ARGV0, , . BASH_CMDS - , - , e hash. , , ' -; -. BASH_CMDS, , . BASH_COMMAND , , , , . BASH_COMMAND, , . BASH_EXECUTION_STRING -c. BASH_LINENO -, , FUNCNAME. ${BASH_LINENO[$i]} (${BASH_SOURCE[$i+1]}), ${FUNCNAME[$i]} ( ${BASH_LINENO[$i-1]}, ). LINENO. BASH_LOADABLES_PATH , , enable. BASH_REMATCH -, =~ [[. 0 , . n , n- . BASH_SOURCE -, , - FUNCNAME. ${FUNCNAME[$i]} ${BASH_SOURCE[$i]} ${BASH_SOURCE[$i+1]}. BASH_SUBSHELL , . 0. BASH_SUBSHELL, , . BASH_VERSINFO -, bash. : BASH_VERSINFO[0] (). BASH_VERSINFO[1] (). BASH_VERSINFO[2] . BASH_VERSINFO[3] . BASH_VERSINFO[4] (, beta1). BASH_VERSINFO[5] MACHTYPE. BASH_VERSION , bash. COMP_CWORD ${COMP_WORDS} , . , (. ). COMP_KEY ( ), . COMP_LINE . , (. ). COMP_POINT . , ${#COMP_LINE}. , (. ). COMP_TYPE , , : TAB -- , ? -- , ! -- , @ -- , , % -- . , , (. ). COMP_WORDBREAKS , readline . COMP_WORDBREAKS, , . COMP_WORDS - (. ), . , readline, COMP_WORDBREAKS, . , (. ). COPROC - (. ), (. ). DIRSTACK - (. ), . , , dirs. , pushd popd. . DIRSTACK , , . EPOCHREALTIME Unix (. time(3)) . EPOCHREALTIME . EPOCHREALTIME , , . EPOCHSECONDS Unix ( time(3)). EPOCHSECONDS . EPOCHSECONDS , , . EUID . . . FUNCNAME -, . 0 - , . ( ) "main". , . FUNCNAME . FUNCNAME , , . BASH_LINENO BASH_SOURCE. FUNCNAME BASH_LINENO BASH_SOURCE . , ${FUNCNAME[$i]} ${BASH_SOURCE[$i+1]} ${BASH_LINENO[$i]}. caller. GROUPS -, , . GROUPS . GROUPS , , . HISTCMD . HISTCMD . HISTCMD , , . HOSTNAME . HOSTTYPE , ', bash. . LINENO , ( 1) . , . LINENO , , . MACHTYPE , , bash , GNU --. . MAPFILE - ( ), , mapfile, . OLDPWD , cd. OPTARG , getopts (. ). OPTIND , getopts (. ). OSTYPE , , bash. . PIPESTATUS - ( ), ( ). PPID . . PWD , cd. RANDOM , , 0 32767. RANDOM . RANDOM , , . READLINE_ARGUMENT - , readline, "bind -x" (. ), . READLINE_LINE readline "bind -x" (. ). READLINE_MARK ( ) readline "bind -x" (. ). . READLINE_POINT readline "bind -x" (. ). REPLY , read, . SECONDS , . SECONDS, , . . SECONDS , , . SHELLOPTS . -o set (. ). , ' SHELLOPTS, , set -o , . , bash - . . SHLVL , bash. SRANDOM 32- . , /dev/urandom arc4random, ' . , . SRANDOM , , . UID . . . . bash . . BASH_COMPAT . . (, 4.2) (, 42), . BASH_COMPAT , . BASH_COMPAT , , , . B . , 4.2 42 , compat42 shopt 42. . BASH_ENV , bash , , , ~/.bashrc. BASH_ENV , , . PATH. BASH_XTRACEFD , , bash , set -x . BASH_XTRACEFD . BASH_XTRACEFD , . , BASH_XTRACEFD 2 ( ) . CDPATH cd. , , , cd. : ".:~:/usr". CHILD_MAX , . Bash , ' POSIX. ( 8192), . . COLUMNS select . , checkwinsize SIGWINCH. COMPREPLY -, bash , , (. ). . EMACS bash , "t", , Emacs, . ENV BASH_ENV (. ) posix. EXECIGNORE (. ), , PATH. , PATH. [, test [[. EXECIGNORE . , , . extglob. FCEDIT fc. FIGNORE , (. READLINE ). , FIGNORE, . ".o:~". FUNCNEST , . , , . GLOBIGNORE , , . GLOBIGNORE, . HISTCONTROL , . ignorespace, , . ignoredups , , , . ignoreboth ignorespace ignoredups. erasedups , , . , , . HISTCONTROL , , HISTIGNORE. , HISTCONTROL. HISTFILE , (. HISTORY ). ~/.bash_history. , . HISTFILESIZE , . , , , , -- . . 0, . ' . HISTSIZE . HISTIGNORE , , . ' ( <<*>>). , HISTCONTROL. , <<&>> . <<&>> ; . -- , HISTIGNORE. extglob. HISTSIZE , (. ). 0, . ', ( ). 500. HISTTIMEFORMAT (null), strftime(3) , ' , history. , , . , . HOME ; cd. . HOSTFILE , /etc/hosts , . ; , bash . HOSTFILE , , bash /etc/hosts . HOSTFILE , . IFS (Internal Field Separator), read. "". IGNOREEOF EOF . , EOF, , bash . , , 10. , EOF . INPUTRC readline. ~/.inputrc (. READLINE ). INSIDE_EMACS , bash , , TERM. LANG , , LC_. LC_ALL LANG - LC_, . LC_COLLATE , , , . LC_CTYPE . LC_MESSAGES , , $. LC_NUMERIC , . LC_TIME , . LINES select . , checkwinsize SIGWINCH. MAIL , MAILPATH, bash Maildir. MAILCHECK ( ) bash . 60 . , . , , . MAILPATH , . , , , <>. $_ , . : MAILPATH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"' Bash ( ), , , (, /var/mail/$USER). OPTERR 1, bash , getopts (. ). OPTERR 1 , . PATH . , (. ). (null) PATH . ' . , bash. ``/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin''. POSIXLY_CORRECT bash, posix , , --posix. , bash posix , set -o posix posix, , . PROMPT_COMMAND , , . , , , . PROMPT_DIRTRIM , , \w \W (. ). . PS0 (. ) . PS1 (. ) . -- "\s-\v\$ ". PS2 , PS1, . -- "> ". PS3 select (. ). PS4 , PS1, , bash . PS4, , . "+ ". SHELL . , bash . TIMEFORMAT , , time. % escape-, . Escape- ; ' . %% %. %[p][l]R . %[p][l]U , . %[p][l]S , . %P , (%U + %S) / %R. ' p , , . 0 , , . ; p, 3, 3. p , 3. ' l , , MMmSS.FFs. p , . , bash , $'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS'. , . . TMOUT , TMOUT read. select , TMOUT , . , . Bash , . TMPDIR , bash , bash . auto_resume , . , . : , , , . , . exact, ; substring, . substring %? (. ). - , ; %. histchars , (. ). , , , , <>. , , . <<^>>. ' , , , , . , <<#>>. , . ' , . bash -. - . declare. , , . ( ). . . , ' . , - []=. , . , declare -a (. ). declare -a []; . declare -A . - declare readonly. . =(1 ... n), []=. . , . , ' , . , , , , , . . , , , : =( 1 1 2 2 ...). , =( [1]=1 [2]=2 ...). , ; . /, , ; . declare. []=, . , ' , , . , ' , -1 . += ; . . - ${[]}. ' . @ *, . -, . , ${[*]} , IFS, ${[@]} . , ${[@]} . , ' , ' . * @ (. ). ${#[]} ${[]}. * @, . , , ' , , . , ' , -1 . - 0. - - . , bash . - , . . () , . ${![@]} ${![*]} , - . @ * . unset. unset [] , , . ' . - . unset , , . unset [], * @, -, , . , * @. , unset , . , , unset, , , . , . declare, local readonly -a -A . , -A. read -a , , . set declare , . , . : , , , , , . : ; , , ( ); . , , : . , , . , ( ). , ; . "$@" "${[@]}", , , $* ${[*]}, (. ). , . , , . , , ' , , , ' . , . . . ; . : a{d,c,b}e <>. {x..y[..]}, x y , , ' , . , x y, . 0, . x y , , , , . , , x y, , C. , x y ( ). , . 1 -1, . - . , . . Bash . . . { , . , ${ -- , }. , , , , : 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 +B set (. ). (<<~>>), ( , ) -. - , - . , HOME. HOME , , . - , ' . - <<~+>>, - PWD. - <<~->>, OLDPWD, . , - N, ' <<+>> <<->>, - , dirs, - . - <<+>> <<->>, <<+>>. , . - : =. , . , PATH, MAILPATH CDPATH -- . , bash , ( ), ' . posix bash , . <<$>> , . , , , ', , . , <<}>>, , , . ${} . , , , , . , (. ) (). (!) nameref, . Bash , ; , . . , , . nameref, , , . ${!*} ${![@]}, . , . , , . , (, :-), bash , . , , . ${:-} . , . . ${:=} . , . . . ${:?} , . , ( , ) , , , . . ${:+} . , . . ${:} ${::} . , , . @ *, @ * , , . , , , , . (. ). ' , . ' , , , . , ' , :-. @ *, , . ' . , -1 . ' , . @ *, , ${[]}. ' , . ' , . . , . , , 1. 0 , $0. ${!*} ${!@} . , . IFS. @ , . ${![@]} ${![*]} . -, () , . , 0, , , . @ , . ${#} . . * @, . * @, . -- ' , . ' , -1 . ${#} ${##} . , . , . , , ( <<#>>) ( <<##>>). @ *, , . - @ *, , . ${%} ${%%} . , . , . , , ( <<%>>) ( <<%%>>). @ *, , . - @ *, , . ${//} ${///} ${/#/} ${/%/} . , . . , , , . , . . ( , . # ( ), . % ( ), . , . , , / . patsub_replacement shopt, & . - , , . & ; & . ; \\ . , , . & ; &, &, . nocasematch, . @ *, , . - @ *, , . ${^} ${^^} ${,} ${,,} . . , . , , . . ^ , , ; , . ^^ ,, ; ^ , . , ?, . @ *, , . - @ *, , . ${@} . , . : U , , () (). u , , (), . L , , () (). Q , , , . E , , , $'...'. P , , (. ). A declare, , , . K , , , - (. ). a , , . k K-, . @ *, , . - @ *, , . . . : $() `` Bash , . , . $(cat ) , , $(< ). , , $, ` \. , , . $(), ; . . . , . . : $(()) , , , . , . . . . , bash , . , . <() >(). , . , . >(), . <(), , , . , (FIFO) /dev/fd . , , . , , . IFS . IFS , , , , , - IFS . IFS , - space, tab newline , IFS (- IFS). - IFS, IFS, - - IFS, . - IFS . IFS , . ("" or '') . , , , . , ; . , , . , -d'' -d . , , . , -f, bash *, ? [. , , -- , (. ). , nullglob, . nullglob, , . failglob, , , . nocaseglob, . , "." , dotglob. "." "..", "." (: ".?"), dotglob. globskipdots, "." ".." , ".". , "." . , , . . shopt , nocaseglob, nullglob, globskipdots, failglob dotglob. , , GLOBIGNORE. GLOBIGNORE, , GLOBIGNORE . nocaseglob, GLOBIGNORE . "." ".." , GLOBIGNORE. , GLOBIGNORE dotglob, , , ".". , ".", ".*" GLOBIGNORE. dotglob , GLOBIGNORE. extglob. - , ' , , , . NUL . ; . , . : * - , (null) . globstar *, * , , . /, * . ? - . [...] - . , , ; - , , . [ ! ^, - . , , LC_COLLATE LC_ALL, . , [a-d] [abcd], LC_ALL C, globasciiranges. - , . ] , . [ ] : [::], , POSIX: alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit - , . word , _. [ ] , [=c=], ( ), c. [ ], [..] . extglob shopt, . _ - , |. : ?(_) *(_) , +(_) @(_) !(_) , extglob , . , extglob , , . dotglob , : dotglob, , ".", "." ".." , ; , , ".", ".". , "." . , , . . \, ' ", , . , , . , , , , , . . , . , . , , {-}. , , >&- <&-, ' , 9, -. >&- <&- {-}, - , . {-}, , . varredir_close. , , <, ( 0). >, ( 1). , , , , , , , , , . , bash . , . , ls > dirlist 2>&1 dirlist, ls 2>&1 > dirlist dirlist, , dirlist. bash -, , . , bash, , bash . , bash , , . /dev/fd/_ _ , _. /dev/stdin 0. /dev/stdout 1. /dev/stderr 2. /dev/tcp// -, -- , bash TCP. /dev/udp// -, -- , bash UDP. . , 9, , , . , , , n ( 0), n . : [n]< , , , n ( 1), n . , ; , . : [n]> > noclobber set, , , , . >| > noclobber set, , , , . , , , n ( 1), n . , . : [n]>> ( 1), ( 2) , . : &> >& . > 2>&1 , -. , (. ). ( 1), ( 2) , . : &>> >> 2>&1 (. ). , , , ( ). , ( n, n) . : [n]<<[-] , , . , , . , , , \< > , \, $ ` \. <<-, , . . . : [n]<<< , , , . . ( n, n). [n]<& . , n . , , . -, n . n , ( 0). [n]>& . n, ( 1). , , . -, n . , n, -, . [n]<&- n ( 0), n . n. , [n]>&- n ( ), n . [n]<> , , n 0, n . , . , . , alias unalias (. ). , , . , , . /, $, ` =, - , . - , . , , , , . , , , ls ls -F, bash . , . alias. unalias. . , (. ). , expand_aliases shopt (. shopt ). , , . Bash , , - . , , . , , . , . . , , . , , , . , alias . . , , , - . , , ' . ; ( ). . #. 0 . FUNCNAME . , , : DEBUG RETURN (. trap ) , trace (. declare ) -o functrace set ( DEBUG RETURN), ERR , -o errtrace. , , local (local variables). . local, ( , ). , . , , , <<>> , . , , local declare , . <<>> , . , , , : , . . . , . , , , , , <<>> . , , <<>> , , . , 1, 1 2, , 2, 1, - . unset : , unset ; , , - , , . , ( ), . , - . , - , , (. , localvar_unset ). FUNCNEST, , . , , . return, . , ' RETURN. , #. -f declare typeset. -F declare typeset (, ', - , extdebug). , (, ), -- -f export. -f unset. . FUNCNEST. , . , , (. let declare, (( ). , 0 . , , , C. , . . id++ id-- - + ++ -- ! ~ ** * / % , , + - , << >> <= >= < > == != & <<>> ^ | <<>> && <<>> || <<>> expr?expr:expr = *= /= %= += -= <<= >>= &= ^= |= expr1 , expr2 ; . . , , 0 . , , integer declare -i . 0. ' integer. C . 0 . 0x 0X . , [#]n, ' 2 64, , n -- . # , 10. n, , , 9 , , @ _, . , 36, , 10 35. . . . [[ test [ . test [ ; . , , , . . , bash . , bash , bash ; , : /dev/fd/n, n; /dev/stdin, /dev/stdout /dev/stderr, 0, 1 2, . , , , , , . [[, < > . test ASCII. -a , . -b , . -c , . -d , . -e , . -f , . -g , . -h , . -k , <<>> . -p , (FIFO). -r , . -s , . -t _ , _ . -u , --. -w , . -x , . -G , . -L , . -N , . -O , . -S , . 1 -ef 2 , 1 2 inode. 1 -nt 2 , 1 ( ) 2, 1 , 2 -- . 1 -ot 2 , 1 2, 2 , -- . -o _ , _. . -o set . -v , _ ( ). -R _ , _ . -z , . -n , . 1 == 2 1 = 2 , . POSIX = test. [[, , ( ). 1 != 2 , . 1 < 2 , 1 2 . 1 > 2 , 1 2 . 1 OP 2 OP : -eq, -ne, -lt, -le, -gt -ge. <<>>, 1 , , , , 2, . 1 2 ' . [[, 1 2 (. ). , , , . 1. , ( ), . 2. , . , , -- . 3. , . 4. = , , , , . , . ( ), . . - , , . , , . . , , . . , , . , . , ' , . , . , , . , . , . , , , bash PATH , . Bash ' - (. ). PATH , -. , command_not_found_handle. , , , , , . , 127. , , . 0 , -- , . , , , , , , . , , , , , ' (. ), . , #!, . , . ' , , - , . , : o , , exec o , cd, pushd popd o , umask o , trap o , set o , o , ( ) set o , shopt o , alias o , , $$ PPID , , , . , . o , o o o , , , , o , , , , , , , , . . , , , , , , , , , . , , . , , . , , -e . posix, bash -e. &, , /dev/null. , , . , . - :=value. . , . . export declare -x. , , . , - , , , , unset, export declare -x. - , . , . -k (. set ), , , , . bash , _ . . , waitpid . 0 255. , , , 125, . . , , . , , , . . . N, bash 128+N. , , , 127. , , 126. , . 0 (), , (), . 2, , -- , . $?. bash , . , . . exit . bash , SIGTERM (, kill 0 ) SIGINT (, wait). bash SIGQUIT. , bash SIGTTIN, SIGTTOU SIGTSTP. , bash, , , . , SIGINT SIGQUIT . , , SIGTTIN, SIGTTOU SIGTSTP. SIGHUP. SIGHUP . SIGCONT, , SIGHUP. , disown (. ) , SIGHUP, disown -h. huponexit shopt, , , bash SIGHUP. bash , , , . bash wait, , , wait 128, . , bash , , SIGINT (, ^C), , , . , , , ^C SIGINT . bash SIGINT , , , , SIGINT: 1. SIGINT, bash , , SIGINT ( SIGINT ); 2. SIGINT, SIGINT . bash SIGINT , , SIGINT (, emacs ) . , bash - , SIGINT, - , , . () () . , bash. . , jobs. bash ( ), : [1] 25647 , 1 ID , ' 25647. . Bash . , . (, ) , SIGINT. , . - , ; , . , stty tostop, . , ( , stty tostop) SIGTTIN (SIGTTOU) , , , . , bash, , bash . ( ^Z, Control-Z) bash. ( ^Y, Control-Y) , , bash. , bg, , fg, , kill, . A ^Z , . . % (jobspec). n %n. , , , ' . , %ce , ce. , bash . %?ce, , - , ce. , bash . %% %+ , , , , . , %-. , %+ %- . , (, jobs), +, - -. % ( ) . , : %1 "fg %1", 1 . , "%1 &" 1 , "bg %1". , . , bash , , . -b set, bash . - SIGCHLD . bash ( , checkjobs shopt), , , checkjobs , . jobs. , , - . wait, , wait , . -f wait, , . , bash PS1, , PS2, . Bash PS0 , . Bash PS4 , , -x. Bash , , : \a ASCII (07) \d <<_ >> (, <>) \D{} strftime(3), ; . \e escape ASCII (033) \h `.' \H \j , \l \n \r \s , $0 ( ) \t 24- HH:MM:SS \T 12- HH:MM:SS \@ 12- / \A 24- HH:MM \u \v bash (, 2.00) \V bash, + (, 2.00.0) \w PWD ($PWD) $HOME ( PROMPT_DIRTRIM) \W $PWD $HOME, \! \# \$ (UID) 0, #, $ \nnn , nnn \\ \[ , \] : - , , (. ), -- , . , , , promptvars (. shopt ). , ' , . READLINE , , --noediting. -e read. Emacs. vi. - -o emacs -o vi set (. ). , +o emacs +o vi set. Readline Emacs. Control C-, , C-n Control-N. , Meta M-, , M-x Meta-X. ( Meta, M-x ESC x, , ESC, x. ESC Meta-. M-C-x ESC-Control-x, ESC, Control x.) readline , . , , . ' , (., kill-line) . , . , (). . , , . , , . Readline Readline ( inputrc). INPUTRC. , ~/.inputrc. , /etc/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 ' , , (). readline , ' inputrc, . , ' . : , Meta- Control-, . _:_ , _ . : Control-u: universal-argument Meta-Rubout: backward-kill-word Control-o: "> output" C-u ' universal-argument, M-DEL ' backward-kill-word, C-o ' , ( ``> output'' ). , "_":_ , _ _ , , , . 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''. GNU Emacs: \C- Ctrl \M- Meta (Windows) \e \\ \" " \' ' GNU Emacs, : \a () \b backspace \d Delete \f \n \r \t \v \nnn , nnn ( ) \xHH , HH ( ) . . . - , " '. Bash ' readline bind. -o set (. ). Readline readline , . inputrc : set _ bind (. ). , readline On Off ( ). . , , "on" ( ) "1" On. Off. : active-region-start-color , (. enable-active-region ). - , . . . , , terminfo. "\e[01;33m". active-region-end-color , <<>> active-region-start-color <<>> . , , . . . , , terminfo. : "\e[0m". bell-style (audible) , , readline . none, readline . visible, readline , . audible, . bind-tty-special-chars (On) On, readline ' , , readline. blink-matching-paren (Off) On, readline , . colored-completion-prefix (Off) On, readline . LS_COLORS. $LS_COLORS <>, readline . colored-stats (Off) On, readline , , . LS_COLORS. comment-begin ("#") , , readline insert-comment. ' M-# emacs # vi. completion-display-width (-1) , . , 0 . 0 . -1. completion-ignore-case (Off) On, readline . completion-map-case (Off) On completion-ignore-case, readline (-) (_) . completion-prefix-display-length (0) , . , , , , . completion-query-items (100) , , possible-completions. - , . , readline , ; . , readline ; ' . convert-meta (On) On, readline ASCII, escape- (, escape ). - On, readline Off, . LC_CTYPE . disable-completion (Off) On, readline . , ' self-insert. echo-control-characters (On) On, , , readline , , . editing-mode (emacs) , readline ' , Emacs vi. _ emacs vi. emacs-mode-string (@) show-mode-in-prompt , , emacs. ' , - . \1 \2, , . enable-active-region (On) , . . On, readline . , readline active-region-start-color, , . , , - , . enable-bracketed-paste (On) On, readline , , , , . readline - , ' , ' . enable-keypad (Off) On, readline . , . enable-meta-key (On) On, readline - , . . expand-tilde (Off) On, readline , . history-preserve-point (Off) On, , previous-history next-history. history-size ( ) , . 0, , . , . HISTSIZE. history-size , 500. horizontal-scroll-mode (Off) On, readline , , , . 1. input-meta (Off) On, readline (, ), , , , . meta-flag . Off, readline On, . LC_CTYPE . 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 . keyseq-timeout (500) readline , (, , ). , readline , . , 1000 , readline . , , , readline , , . mark-directories (On) On, . mark-modified-lines (Off) On, , (*). mark-symlinked-directories (Off) On, , , ( mark-directories). match-hidden-files (On) , On, readline , `.' ( ) . Off, `.' , . menu-complete-display-prefix (Off) On, ( ) . output-meta (Off) On, readline , escape- . Off, readline On, . LC_CTYPE . page-completions (On) On, readline more . print-completions-horizontally (Off) On, readline , . revert-all-at-newline (Off) On, readline , accept-line. readline. show-all-if-ambiguous (Off) . On, , , . show-all-if-unmodified (Off) , show-all-if-ambiguous. On, , - ( ), . show-mode-in-prompt (Off) On, , : emacs, vi, vi. (., emacs-mode-string). skip-completed-text (Off) On, . . , readline , , , . vi-cmd-mode-string ((cmd)) show-mode-in-prompt , , vi . ' , - . \1 \2, , . vi-ins-mode-string ((ins)) show-mode-in-prompt , , vi . ' , - . \1 \2, , . visible-stats (Off) On, , , stat(2). readline Readline , C, ' . . $if $if ' , , , , readline. - ; , . mode mode= $if , readline emacs vi. set keymap, , ' emacs-standard emacs-ctlx, readline emacs. term term= ' , , ' . = -. , , sun sun, sun-cmd. version version readline. version readline. = ( ==), !=, <=, >=, < >. , , , ' ' (, 7.1). , 0. version . application application . , readline, , . ' , . , , bash: $if Bash # "\C-xq": "\eb\"\ef\"" $endif variable variable readline. =, == !=. ; . , . on off. $endif , , $if. $else $if , . $include ' . , /etc/inputrc: $include /etc/inputrc readline (. ) , . : . , . , readline , . . isearch-terminators. ' , Esc Ctrl-J. Ctrl-G . , . , Control-S Control-R, . , . - ' readline . , newline , . Readline ' . Ctrl-R , '. , . . readline , '. '. , point , mark , set-mark. , region. beginning-of-line (C-a) . end-of-line (C-e) . forward-char (C-f) . backward-char (C-b) . forward-word (M-f) . . backward-word (M-b) . . shell-forward-word . , . shell-backward-word . , . previous-screen-line . , readline . next-screen-line . , readline readline . clear-display (M-C-l) , , , , . 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->) , , . operate-and-get-next (C-o) . , , , . fetch-history . , . 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 . - . history-substring-search-backward (). - . - . history-substring-search-forward . - . - . yank-nth-arg (M-C-y) ( ) . n, n- ( 0). n- . n , "!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. edit-and-execute-command (C-x C-e) . Bash $VISUAL, $EDITOR emacs, . end-of-file ( C-d) , , , , ``stty''. , , , readline EOF. delete-char (C-d) . ' , tty EOF, C-d, . . 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) , . , . ' . transpose-words (M-t) , . , . upcase-word (M-u) ( ) . ' , , . downcase-word (M-l) ( ) . ' , , . capitalize-word (M-c) ( ) . ' , , . overwrite-mode . . . emacs; vi . readline() . , ' self-insert, , . , ' backward-delete-char, . '. kill-line (C-k) . backward-kill-line (C-x Rubout) . unix-line-discard (C-u) . . kill-whole-line ' . kill-word (M-d) , , . , forward-word. backward-kill-word (M-Rubout) . , backward-word. shell-kill-word , , . , shell-forward-word. shell-backward-kill-word . , shell-backward-word. unix-word-rubout (C-w) , . . unix-filename-rubout , , . . 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 . , , <<>>, . , universal-argument , . , , , <<>>, . , , -- , . complete (TAB) . Bash , ( $), ( ~), ( @) ( ) . , . possible-completions (M-?) . insert-completions (M-*) , possible-completions. menu-complete complete, . menu-complete , . , ( bell-style) . n n ; . ' TAB, '. menu-complete-backward menu-complete, , menu-complete . '. 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) , . dabbrev-expand , . complete-into-braces (M-{) , (. ). start-kbd-macro (C-x () . end-kbd-macro (C-x )) . call-last-kbd-macro (C-x e) , , . print-last-kbd-macro () , , inputrc. re-read-init-file (C-x C-r) inputrc ' , . abort (C-g) ( bell-style). do-lowercase-version (M-A, M-B, M-x, ...) 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-<>) . , . exchange-point-and-mark (C-x C-x) . , . character-search (C-]) , . ' . character-search-backward (M-C-]) , . ' . skip-csi-sequence , , , Home End. (CSI), , ESC-[. ' "\[", , , ' readline, -- . , ', , , ' ESC-[. insert-comment (M-#) readline comment-begin. , : comment-begin, , , comment-begin . , . comment-begin . , . spell-correct-word (C-x s) , , , cdspell. , shell-forward-word. glob-complete-word (M-g) . . 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. , (compspec) complete (. ), . , . ( ), - compspec, -E complete. compspec, compspec . , compspec . compspec, compspec , . compspec, , - compspec, -D complete. compspec , bash , , compspec - . compspec, . compspec , bash, . , , compspec. , , . -f -d, FIGNORE. , -G. ' , . GLOBIGNORE, FIGNORE. , , -W. , IFS, . . , , , , . , . , , . . , , - -F -C. , COMP_LINE, COMP_POINT, COMP_KEY COMP_TYPE , . , COMP_WORDS COMP_CWORD. , ($1) , , ($2) -- , , ($3) -- , , . ; . - , -F. , compgen, , . - COMPREPLY, . , - , -C, , . , , . , , . , - , -X. - , ujhnf ; & , . & ; . - , , . ! ; - , . nocasematch, . , - , -P -S, , readline . , -o dirnames complete compspec, . compspec complete -o plusdirs, , . , compspec, . bash , readline . -o bashdefault complete compspec, bash, compspec . -o default complete compspec, readline, compspec (, , bash) . compspec , , readline , readline mark-directories, readline mark-symlinked-directories. . , , complete -D. , , , , 124. 124 compspec, ' , ( , ), compspec . , . , , compspec, , , : _completion_loader() { . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124 } complete -D -F _completion_loader -o bashdefault -o default -o history set, , - , . HISTSIZE . HISTSIZE ( - 500). (. ), , HISTIGNORE HISTCONTROL. , HISTFILE ( ~/.bash_history). , HISTFILE , , HISTFILESIZE. HISTFILESIZE , null, ' , . , , , , . , HISTTIMEFORMAT. $HISTSIZE $HISTFILE. histappend (. shopt SHELL BUILTIN COMMANDS), , . HISTFILE , , . HISTTIMEFORMAT, , . . , HISTFILESIZE . HISTFILESIZE , null, ' , . fc (. SHELL BUILTIN COMMANDS) . history . , , , . , . HISTCONTROL HISTIGNORE , . cmdhist, , , , . lithist . , . shopt . , csh. . +H set (. ). . , , . , , , . . - , . -- . , , -- , , , -- . . , , , , , . , !. (\) , , . , ' , : , , , =. extglob, ( . shopt. histverify (. shopt ) readline, . , readline . readline histreedit, readline . -p history , , . -s history , , , . , (. histchars ). . - . , . ! , , , , = ( ( extglob shopt). !n n. !-n n. !! . <>. ! , . !?[?] , . ? , . , . , . ^1^2^ . , 1 2. "!!:s^1^2^" (. ). !# , . . : . , ^, $, *, - %. . 0 (). . 0 () . . n n- . ^ . , 1. $ . , , , . % , `??', , . x-y ; <<-y>> -- <<0-y>>. * , . <<1-$>>. *, -- . x* x-$. x- x-$, x*, . x, 0. - , . ' , <<:>>. , . h , . t , . r .xxx, . e , . p , . q , . x , q, . q x ; . s/// . - /. ', . . &, . &. , , , !?[?]. , . & . g . <<:s>> (, <<:gs///>>) <<:&>>. <<:s>>, - /, ', . a g. G <> <<&>> . , , , -, -- . :, true, false test/[ -- . exit, logout, return, break, continue, let shift , -, --. , , , , , -, , -- . : [] ; , - . . . _ [] source _ [] _ _. _ , , _, _ ' , PATH. , PATH, . bash posix, , PATH . shopt sourcepath, PATH . - , _. , . -T, . DEBUG; , DEBUG ., . DEBUG . -T , DEBUG, .. (0, ) <<>>, _ . alias [-p] [[=] ...] Alias -p alias = . , , . , . , , . Alias <<>>, , . bg [_ ...] _ , , &. _ , . bg _ 0, , , _, , . bind [-m '_] [-lpsvPSVX] bind [-m '_] [-q ] [-u ] [-r _] bind [-m '_] -f _ bind [-m '_] -x _:_ bind [-m '_] _:_ bind [-m '_] _:_readline bind --readline ' readline, ' readline readline. , , , readline, .inputrc, ' ' . : '"\C-x\C-r": re-read-init-file'. , , : -m '_ '_ ' , '. '_ emacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move, vi-command vi-insert. vi vi-command (vi-move ); emacs emacs-standard. -l readline. -p readline ' , . -P readline '. -s ' readline , , . -S ' readline , . -v readline , . -V readline . -f _ ' _. -q , function. -u ' , ' function. -r _ - ' keyseq. -x _:- , _ -. - READLINE_LINE readline, READLINE_POINT READLINE_MARK (), . - READLINE_ARGUMENT. , . - READLINE_LINE, READLINE_POINT READLINE_MARK, . -X , ' , ' , . 0, . break [n] for, while, until select. n, n . n >= 1. n , . 0, n 1. builtin -- [] , , . , , , . cd. <<>>, --. caller [] - ( , . source). , caller . , caller , , . , , . 0. 0, . cd [-L|[-P [-e]] [-@]] [] dir. dir , HOME. CDPATH , dir: CDPATH dir. CDPATH (:). CDPATH , , ".". dir (/), CDPATH . -P cd , ' dir .. dir (. -P set); -L , ' .. dir. .. ' dir, dir, dir. -e -P, , cd . , -@, , ' , . - $OLDPWD . CDPATH, - , , . , cd PWD , OLDPWD . , , - . [-pVv] [ ...] , . , PATH. -p, PATH, . -V -v, . -v, , , . -V . -V -v, 0, , 1, . , , 127. . compgen [] [] - , . - , complete -p -r. . -F -C , , , . , . , , . true, . complete [-abcdefgjksuv] [-o -] [-DEI] [-A action] [-G _] [-W _] [-F ] [-C ] [-X _] [-P ] [-S ] [ ...] complete -pr [-DEI] [ ...] , . -p , , . -r , , . -D , <<>> ("default") ; , , . -E , <<>> ("empty") ; , . -I , , , , ; |, , , . , -D -E, -I. - -D, -E -I, ; , . above under Programmable Completion. , , . -G, -W -X (, , -P -S) , complete. -o - - compspec . - : bashdefault bash, compspec . default readline, compspec . dirnames , compspec . filenames readline, compspec, - , ( , ). . noquote readline, , (, ). nosort readline, . nospace readline, ( ) , . plusdirs , compspec, . . -A : alias . -a. arrayvar -. binding ' readline. builtin . -b. . -c. directory . -d. disabled . enabled . export . -e. . -f. function . group . -g. helptopic , help. hostname , , HOSTFILE. job , . -j. keyword . -k. running , . service . -s. setopt -o set. shopt , shopt. signal . stopped , . user . -u. variable . -v. -C , . , -F. -F . ($1) , , ($2) , , ($3) , , , . - COMPREPLY. -G _ _. -P . -S . -W _ IFS , . _ , , IFS. -, , . -X _ _ -- , . , , , _ . ! _ . , , _. <<>>, , , -p -r, , , , . compopt [-o ] [-DEI] [+o ] [] , , , . , . complete, . -D , <<>> . , . -E , <<>> . . -I , , , , ; |. , . <<>>, , , , . continue [n] for, while, until select. n, n- . n >= 1. n , ( ). 0, n 1. declare [-aAfFgiIlnrtux] [-p] [[=] ...] typeset [-aAfFgiIlnrtux] [-p] [[=] ...] / . , . -p . -p , , -f -F, . -p , , . -p, declare . -f . -F -- . extdebug shopt, . -F -f. -g , declare . . -I ( nameref) , . , , , . : -a - (. above). -A - (. above). -f . -i ; (. above) . -l () (). . -n nameref, . . , , , -n, , . nameref -. -r . . -t . DEBUG RETURN , . . -u () (). . -x . <<+>> <<->>, , , +a +A - +r << >>. , declare typeset , local, -g. =, . -a -A -, , . 0, , ``-f foo=bar'', , - (. above), , , << >> , - , , -f. dirs [-clpv] [+n] [-n] , '. , . pushd; popd . . -c . -l ; . -p . -v . +n n- , , dirs ; . -n n- , , dirs ; . 0, , n . disown [-ar] [-h] [- ... | pid ... ] , - . - , -a, -r, . -h, - , , SIGHUP, SIGHUP. -, -a ; -r - . 0, - . echo [-neE] [ ...] , . 0, . -n, . -e, . -E , , . xpg_echo , echo . echo --, . echo : \a () \b backspace \c \e \E \f \n \r \t \v \\ \0nnn , nnn ( ) \xHH , HH ( ) \uHHHH Unicode (ISO/IEC 10646), HHHH ( ) \UHHHHHHHH Unicode (ISO/IEC 10646), HHHHHHHH ( ) enable [-a] [-dnps] [-f _] [ ...] . , , , , , , , . -n, , ; , . , test, , PATH, , ``enable -n test''. -f , ' _ , . Bash BASH_LOADABLES_PATH , , _. The default is system-dependent. -d , -f. -p, . , . -n, . -a, , . -s, POSIX. , enable ' , ``enable -f name name . 0, ' . eval [ ...] ' . , eval. , eval 0. exec [-cl] [-a ] [ []] , . . . -l, , . , login(1). -c , . -a, . , , execfail. , . , . , exec . , 0. , 1. exit [n] n. n , . EXIT. export [-fn] [[=]] ... export -p . -f, . -p, . -n . =, . export 0, , -f , . fc [-e _] [-lnr] [] [] fc -s [=] [] . ( , ) ( , ' ). 0 -1, -0 (, fc). , 0 -1, -0 . , (, ``fc -l -10'' 10 ) . , , -16 . -n . -r . -l, . , , , , _. _ , FCEDIT EDITOR, FCEDIT . , vi , . . , . ``r="fc -s"'', , ``r cc'' , ``cc'' ``r'' . , 0, . -e, , . , , . fc . fg [_] _ . _ , . , , , , , , _ _ . . getopts _ [ ...] getopts . _ , ; , , . . getopts , , , , , OPTIND. OPTIND 1 , . , getopts OPTARG. OPTIND; getopts , . , getopts , . OPTIND ?. , getopts , , , getopts . getopts . _ , . , . OPTERR 0, , _ . , getopts ? , , OPTARG. getopts , OPTARG, . ' getopts , (?) , OPTARG . getopts , (:) , OPTARG . getopts <<>>, , . <<>>, . hash [-lr] [-p _] [-dt] [] , hash, ' $PATH. ' . -p, , _. -r , ' . -d ' . -t, . -t, . -l , , . -l, '. <<>>, . help [-dms] [] . , help , . , . -d -m , -s 0, , . history [n] history -c history -d history -d - history -anrw [_] history -p [ ...] history -s [ ...] , . , *, . n n . HISTTIMEFORMAT null, strftime(3), , ' . . , ; , HISTFILE. , : -c . -d . ', , . , ' , -1 history -d. -d - , . ' . -a <<>> . , bash, . -n , . , bash. -r . -w , . -p . . . -s . . HISTTIMEFORMAT, , , . , , , , , . 0, , , -d, , -p . jobs [-lnprs] [ _ ... ] jobs -x [ ... ] . : -l . -n , , . -p , . -r , . -s . _, . 0, _. -x, jobs - jobspec, command args , command args, . kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ... kill -l|-L [sigspec | exit_status] , sigspec signum , pid jobspec. sigspec ( ), . SIGKILL ( SIG) ; signum . sigspec , SIGTERM. -l . - , -l, , , 0. exit_status -l , , . -L -l. kill , , , . let arg [arg ...] , (. above). arg 0, let 1; 0. local [option] [[=value] ... | - ] , . - , declare. local , , '. -, , local: , set , . , set , . , local . local . 0, local , . logout . mapfile [-d ] [-n ] [-O ] [-s ] [-t] [-u _] [-C _] [-c ] [] readarray [-d ] [-n ] [-O ] [-s ] [-t] [-u _] [-C _] [-c ] [] -- , _, -u. MAPFILE. , , : -d . , mapfile , NUL. -n . 0, . -O . 0. -s count . -t ( ) . -u _, . -C _ , . -c. -c , _. -C -c, 5000. callback , , , , , , . callback , . , mapfile . mapfile , , , , . popd [-n] [+n] [-n] . 0 dirs. . , , : -n , , . +n n- , , dirs; . : ``popd +0'' , ``popd +1'' . -n n- , , dirs; . : ``popd -0'' , ``popd -1'' . , B, popd cd . cd , popd . popd <<>>, , , . popd , bash dirs, , 0. printf [-v ] [] . -v var . , ': , , , , , . printf(1), printf : %b printf , echo -e. %q printf argument , , . %Q %q, - . %(_)T printf -, datefmt, strftime(3). argument , . : -1 , -2 , . , , -1. printf. %b, %q %T ( ) , , . C, , , , ASCII . . , , , , . , , . pushd [-n] [+n] [-n] pushd [-n] [] , . , pushd . , , : -n , , . +n , n- ( , dirs ) . -n , n- ( , dirs ) . , -n, pushd cd . cd , pushd . , , pushd 0, . pushd 0, , . pushd , bash dirs, . pwd [-LP] . -P -o set, . -L, . 0, . read [-ers] [-a ] [-d ] [-i ] [-n _] [-N _] [-p ] [-t _] [-u _] [ ...] _, -u, , above , , -- . , . , , . IFS. , ( above ). (\). , , : -a _ - aname, 0. aname . . -d . , read , NUL. -e , readline (. READLINE above) readline ( , ) , readline. -i readline , . -n -_ read _ , , , _ . -N -_ read _ , , EOF read . -, , read, _ . IFS; , ( ; . -r). -p , , - . , . -r . , . , << -- >> . -s . , . -t _ read , ( ) _ . . , read , -- . read read - . _ 0, read , . 0, EOF. , . 128, . -u _ _. , , , , REPLY. , , read ( 128), (, , ) -u. readonly [-aAf] [-p] [[=] ...] , ; . -f, , . -a , -A -- . , -A. , -p, . . -p , . =, . 0, , -f , . return [n] , n, , . n , , . return , , , , . return DEBUG, , , , return. return , . (source), n , , . n, 8 . , return . source. , ' RETURN. set [-abefhkmnptuvxBCEHPT] [-o -] [--] [-] [ ...] set [+abefhkmnptuvxBCEHPT] [+o -] [--] [-] [ ...] , , . , , . posix . . , . , , . , , $1, $2, ... $n. , , : -a , , . -b , . , . -e , ( ), (. above), . , , , while until, if elif, - , && ||, && ||, - , , !. , , , -e, . ERR, . (. above), , , . , -e, , , -e, -e . -e , -e , , . -f . -h ' , . . -k , , , . -m . . , , (. above). . . -n , . . . -o _ option-name : allexport , -a. braceexpand , -B. emacs emacs. , --noediting. , read -e. errexit , -e. errtrace , -E. functrace , -T. hashall , -h. histexpand , -H. history , above . . ignoreeof , ``IGNOREEOF=10'' (. Shell Variables above). keyword , -k. monitor , -m. noclobber , -C. noexec , -n. noglob , -f. nolog . notify , -b. nounset , -u. onecmd , -t. physical , -P. pipefail , , , ( ) , . . posix bash , POSIX , ( posix). . below , , posix bash. privileged , -p. verbose , -v. vi vi. , read -e. xtrace , -x. -o _, . +o _, set . -p . $ENV $BASH_ENV , , SHELLOPTS, BASHOPTS, CDPATH GLOBIGNORE, , . (), () -p, , . -p, . , . -r . , . -t . -u , <<@>> <<*>> - <<@>> <<*>>, . , , , . -v . -x , for, case, select for PS4, ' . -B (. Brace Expansion above). . -C , bash , >, >& <>. >| >. -E , - ERR , , . , , ERR . -H !. , . -P , ' , cd, . . , bash, , , . -T , - DEBUG RETURN , , . , , DEBUG RETURN . -- , . , , -. - , . -x -v . , . , . + - . . $-. , . shift [n] n+1 ... $1 .... , $# $#-n+1 . n ' , $#. n 0, . n , 1. n $#, . n $# , ; - 0. shopt [-pqsu] [-o] [_ ...] , ' . , , -o, -o set. -p, , , , ; optnames, . -p , . : -s () optname. -u () optname. -q ( ); , optname. optname -q, optnames, , ; - . -o _ , -o set. -s -u optname, shopt , . , shopt ( ). , optnames , - . , , optname . shopt: assoc_expand_once , , , , , . autocd , , , , cd. . cdable_vars , cd, , , , . cdspell , cd . : , . , , . . checkhash , bash , , -, . , . checkjobs , bash, , - . , , (. above). , . checkwinsize , bash ( ) , , LINES COLUMNS. . cmdhist , bash . . , , , above . compat31 compat32 compat40 compat41 compat42 compat43 compat44 compat50 (. SHELL COMPATIBILITY MODE below). complete_fullquote , bash . , bash , , , , ' , . , , , ; - , ' , . , bash . , bash 4.2. direxpand , bash, , . readline. , bash , . dirspell , bash , . dotglob , bash , `.'. "." ".." , dotglob. execfail , , , exec. exec. expand_aliases , , above . . extdebug , , --debugger. , : 1. -F declare , . 2. DEBUG , . 3. , DEBUG, 2, ( , . source), return. 4. BASH_ARGC BASH_ARGV , above). 5. : , , ( ) DEBUG RETURN. 6. : , , ( ) ERR. extglob , , above . extquote , $'' $"" ${}, . . failglob , , , . force_fignore , , FIGNORE, , . . above , FIGNORE. . globasciiranges , , (. above) C. , b A B, ASCII . globskipdots , "." "..", ".". . globstar , **, , . /, . gnu_errfmt , GNU. histappend , , , , HISTFILE, . histreedit , readline, e . histverify , readline, . readline, . hostcomplete , readline, bash , , @ (. READLINE above). . huponexit , bash SIGHUP. inherit_errexit , errexit, . , posix. interactive_comments , , #, (. above). . lastpipe , , . lithist , cmdhist , , , . localvar_inherit , , , . nameref . localvar_unset , unset , . . login_shell , (. above). . mailwarn , , bash , , << _ >>. no_empty_cmd_completion , readline, bash PATH, . nocaseglob , bash (. above). nocasematch , bash - case [[, . noexpand_translation , bash $"..." . , . nullglob , bash , (. above) , , . patsub_replacement , bash & - , , above. . progcomp , (. above) . , . progcomp_alias , , bash , , . , bash , . promptvars , , , , above. . restricted_shell , (. below). . , , . shift_verbose , shift , . sourcepath , . (source) PATH , , . , . varredir_close , , {-} (. above) . xpg_echo , echo . suspend [-f] , SIGCONT. ; -f. 0, -f. test [ ] 0 () 1 (), . . , above . test , -- . . . . . . ' , . ! , . ( ) . . -a 2 , , 1 2, true. 1 -o 2 , 1 2 true. test [ . 0 . 1 , . 2 !, , . above , , <<>>. , . 3 , . , above , , . -a -o , . !, , . (, -- ), . <<>>. 4 , , . !, , . . (, -- ), . , . 5 . test [, < > ASCII. times , . 0. trap [-lp] [[] _ ...] , _ . ( _) -, (, ). , , _ , . -p, , ' _. -p, trap , ' . -l , . _ , , . . SIG '. _ EXIT (0), . _ DEBUG, , for, case, select, - for , (. above). extdebug shopt, DEBUG. _ RETURN, , , . source. _ ERR, , ( ), , . ERR , , while until, if, , && ||, && ||, - , , !. , errexit (-e). , , . , , , . false, - sigspec ; trap true. type [-aftpP] [ ...] , , . -t, type alias, keyword, function, builtin file, name , , , . , , false. -p, type , , , , ``type -t name'' . -P PATH , ``type -t name'' . , -p -P , ' , ' PATH. -a, type , . , -p . -a . -f , command. type true, , false, . ulimit [-HS] -a ulimit [-HS] [-bcdefiklmnpqrstuvxPRT []] , , , , , . -H -S , ' . , root; ' . -H, -S, ', . , , hard, soft unlimited, , ' . , ' , -H. , , , . : -a ; -b -c -d -e (<>) -f , -i -k k-, ' -l , ' -m ( ) -n ( ) -p 512- ( ) -q POSIX -r -s -t -u , -v ' ', , , , -x -P -R , , -T -a, . , -f. 1024 , -t, ; -R, ; -p, 512 ; -P, -T, -b, -k, -n -u, ; posix -c -f, 512 . 0, . umask [-p] [-S] [] . , ; , , , chmod(1). , . -S . . -p , , . 0, . <<>>. unalias [-a] [ ...] . -a, . <<>>, . unset [-fv] [-n] [ ...] . -v, , . . -f, , . -n nameref, , , . -n , -f. , . , , . , , . BASH_ALIASES, BASH_ARGV0, BASH_CMDS, BASH_COMMAND, BASH_SUBSHELL, BASHPID, COMP_WORDBREAKS, DIRSTACK, EPOCHREALTIME, EPOCHSECONDS, FUNCNAME, GROUPS, HISTCMD, LINENO, RANDOM, SECONDS SRANDOM, , . <<>>, . wait [-fn] [-p _] [ ...] . . , . , wait , $!, . -n, wait . , - . , , , 127. -p, , , _, . , . , -n. -f , wait , , . , , 127. wait , , 128, above. , . bash-4.0 , shopt: compat31, compat32, compat40, compat41 . -- . , , . . , (, compat32 , , bash-3.2 ). , , compat32, , , , . , , bash, . , [[ bash-4.1, ASCII, compat32 ASCII. , . , . bash-4.3 : BASH_COMPAT. , ( , 4.2, , compatNN, 42), . bash-4.4, bash . , BASH_COMPAT. Bash-5.0 , shopt . BASH_COMPAT bash-5.0 . , . compat NN NN, . bash-5.0 shopt compatNN. bash-4.3 BASH_COMPAT, bash-5.1 . compat31 o [[ (=~) compat32 o , <>, ( bash-4.0 , , , ) compat40 o < > [[ ; ASCII. Bash bash-4.1 ASCII strcmp(3); bash-4.1 strcoll(3). compat41 o posix time , ( POSIX 267) o posix , , -: ( POSIX 221) compat42 o - , bash-4.2 o posix : ( POSIX 221); compat43 o , declare (declare -a foo='(1 2)'). o , , posix ( , , ) o (while/until/) , break continue . Bash-4.4 , compat44 o , BASH_ARGV BASH_ARGC, , o , break continue . Bash-5.0 , o , , export readonly, , , , posix compat50 o bash-5.1 $RANDOM, . 50 , bash-5.0 , RANDOM , bash-5,0 o - , bash bash-5.1 , , . Bash-5.1 , -l. compat51 o unset @ * -, , , . bash rbash, -r, . , , . bash, , : o cd o SHELL, PATH, HISTFILE, ENV BASH_ENV o , / o , /, . o , , history o , , -p hash o o SHELLOPTS o >, >|, <>, >&, &>, >> o exec o -f -d enable o enable o -p command o set +r shopt -u restricted_shell. . When a command that is found to be a shell script is executed (see COMMAND EXECUTION above), rbash . . Bash Reference Manual, Brian Fox Chet Ramey The Gnu Readline Library, Brian Fox Chet Ramey The Gnu History Library, Brian Fox Chet Ramey Portable Operating System Interface (POSIX) Part 2: Shell and Utilities, IEEE -- http://pubs.opengroup.org/onlinepubs/9699919799/ http://tiswww.case.edu/~chet/bash/POSIX -- posix sh(1), ksh(1), csh(1) emacs(1), vi(1) readline(3) /bin/bash bash /etc/profile , ~/.bash_profile , ~/.bashrc ~/.bash_logout , ~/.bash_history HISTFILE, , bash ~/.inputrc readline Brian Fox, Free Software Foundation bfox@gnu.org Chet Ramey, chet.ramey@case.edu bash, . , , , bash. ftp://ftp.gnu.org/pub/gnu/bash/ http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-master.tar.gz. , bashbug . , , , ! <<>> bug-bash@gnu.org Usenet gnu.bash.bug. : bash , <<>>, bashbug , . chet.ramey@case.edu. . bash sh , ', , POSIX. . . `a ; b ; c' . , . , , . - () . . Andrij Mizyk , Andriy Rysin , Yuri Chornoivan lxlalexlxl ; , GNU General Public License Version 3 . . , , : . GNU Bash 5.2 19 2022 BASH(1)