You are on page 1of 7

BA SH REFERENCE

DEFI
NI
TI
ONS
Thi
s ca
rdde
scri
bes version 2.
0
2.
0ofbash.

CONTENTS
A li
a
si
ng.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.6
A rithme
ti
cEva
luation.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.8
Ar
r
a
y
s.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.1
3
BraceExpansi
on.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.6
Bui
ltIn Commands .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.1
6
CommandLi
neA r
guments .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.3
CommandSubstitution.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.8
Conditi
ona
lExpressi
ons .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.1
5
Contr
olCommands .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.1
4
Def
initi
ons.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.2
ExecutionOr
der.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
3
FieldSpli
tti
ng.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.8
Functions .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.1
2
H istor
ySubstitution.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.5
I
nput/
Output.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.1
3
I
nvoca
tion andSta
rtup.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.3
JobI
ds andJobContr
ol.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.24
Options Toset.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.22
Options Tos hopt.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.23
Options Tote
st.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.21
Pa
tte
r
ns.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.9
Pre
Def
inedVa
r
iables .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.1
0
Proce
ss Substitution .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.8
Prompting.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.4
Quoting.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.6
Rea
dli
ne.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.25
Rea
dli
neDir
ectives .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
25
Rea
dli
neKeyBi
ndi
ngs .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
25
Rea
dli
neVa
r
iables .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.26
Restri
ctedba
sh.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.2
Signals a
ndTraps .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.1
3
Specia
lCha
r
a
c
te
r
s.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.24
Ti
ldeSubstitution.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.6
Va
r
iableAssi
gnment.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.9
Va
r
iableNames .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.9
Va
r
iableSubstitution .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.7
Thi
s ref
erenceca
r
dw a
s w ritten byA r
noldRobbi
ns.
We
thankChe
tRa
mey(
ba
sh
s ma
inta
i
ner
)f
orh
i
sh
elp.

OTHER SSC PRODUCTS:


Speci
a
lizedSystems Cons ulta
nts,
I
nc.
(
20
6)FORUNI
X/
(
20
6)7
827
7
33
FAX:(
20
6)
7
827
1
9
1
Ema
i
l
:sa
l
es@ ssc.
com
URL:h
ttp:
/
/
w w w.
ssc.
com
LinuxJourna
lThePre
mi
erLi
nuxMaga
zine
Technica
lBook
s andCDs
SA MBA :I
nteg
r
a
tingUNIX a
ndW indow s
ShellTutor
ia
ls,
KSH Ref
erence
VI&Emacs Ref
erences,
VITutor
ia
l

Seve
ra
lty
pef
aces a
reusedtocla
rif
ythemea
ni
ng:
Serif
aBoldi
s usedf
orcompute
ri
nput.
Se
r
i
f
aI
ta
l
i
c is used to i
ndica
te u
ser input a
nd f
or
sy
nta
c
ticplace
holders,
sucha
s va
r
ia
bl
eorcmd.
Se
rif
aRoman is usedf
ore
x
pla
na
toryte
x
t.
bl
a
nk
or more spaces a
nd/
or tab char
a
cters.I
n additi
on,
w or
ds a
r
e te
rmi
na
ted by a
ny of the f
ollow i
ng
char
a
c
ters:
;&()|<>spacetabnew line
comma
nd

w ords.

l
i
st
pi
pe
l
i
ne
s.Can be separatedby;
,&,
&&,
|
|andoptiona
llybete
rmi
na
tedby;
,
&.
n
na
me
k
e
y
wo
r
d
ba
sh la
nguage.
Key
w ords a
re speci
a
l onlya
f
tera;or new li
ne,a
f
ter
a
notherk
e
y
w ord,a
ndi
ncerta
i
n otherconte
x
ts.
p
a
t

bashpa
ttern.
Se
ePa
tter
ns.

pi
pe
l
i
ne
byapi
pe(
|
)
.
stri
ng
substitution
command li
ne w ith di
f
f
e
r
e
nt te
x
t,e
.
g
.
,r
e
pla
cing a
va
r
ia
ble w ith its va
lue. ba
sh per
f
orms many
s ubstitutions.
Thi
s ca
rdli
sts them i
n theor
dertheya
re
per
f
or
med.
wo
r
d
necessa
r
yi
fitconta
i
ns speci
a
lcharacters.

RESTRI
CTED ba
sh
itis
I
fbashis i
nvok
eda
s rba
sh,
orw iththe option,
r
e
stri
cte
d.Thef
ollow i
nga
ctions a
re not a
llow ed in a
r
e
stri
ctedsh
ell:
chang
i
ngdir
ectoryw ithcd
setti
ngorunse
tti
ng$
SH ELL or$
PATH
usi
ngpa
thna
me
sf
orcommands thatconta
i
n/
usi
ngapa
thna
metha
tconta
i
ns /
f
orthe.
command
i
mportingf
uncti
ons f
rom theenvir
onment
pa
rsi
ng$
SH ELLOPTS a
tsta
rtup
redir
e
ctingoutputw ithanyof>,
>|
,
<>,
>&,
&>,
or>>
usi
ngexectorun adi
f
f
erent command
addi
ngordele
tingbuilti
ncommands w ithena
ble
usi
ng
toby
pa
ss ar
e
stricted$
PATH
usi
ngse
t+
rorset+
orestricted
These r
e
stricti
ons a
re i
n ef
f
ect a
f
te
r executing a
ll
sta
rtupf
i
l
es,
a
llow i
ngtheauthorofthesta
rtupf
i
l
es f
ull
contr
ol i
n setting up the r
e
stri
cted envir
onment.(
I
n
pr
a
c
ti
ce,r
estri
cted sh
ells a
re not usedmuch
,a
s they
a
redi
f
f
iculttosetupcor
r
ectly
.
)

Er
r
orRepor
ting
I
fy
ouf
inda
n er
r
orin thi
s ref
erenceanda
r
eth
ef
irstto
Copyr
ight1
999Speci
a
li
zedSy
stems Cons ultants,
I
nc.
, repor
t it,w ew illsend y
ou af
r
eecopyofanyofour
P
.
O.
Box55549
,
Se
a
ttle,
WA9
81
550
549
.
reference
s.Plea
se w rite,or s end electr
oni
c ma
il to
A llRi
ghts Reser
ved.
bugs@ssc.
com.
1

COMMA ND LI
NEA RGUMEN TS
ba
sh acce
pts the one le
tter opti
ons to set,and the
additiona
lonelettera
ndG N Usty
lelongoptions show n
below .
$
ba
sh[
options][
a
r
g
s]
cmd

ends option pr
oce
ssi
ng
ends option pr
oce
ssi
ng
execute cmd (
de
f
ault r
ea
ds
command f
r
om f
i
le named i
n
f
irst entryofa
r
g
s andf
oundvi
a
pa
ths ea
rch)
pr
int a
lldouble quote
dstri
ngs
tha
ta
re preceded by a $to
stdout.This i
mpli
es
,no
commands a
r
eexecuted
se
tinte
r
a
c
ti
vemode
se
tr
estri
ctedmode
read commands f
rom stdin
(
def
ault)
sa
mea
s
,
butoutput i
n GNU
g
ettextf
orma
t
sa
mea
s
di
s pla
yah
elpmessa
geandexi
t
successf
ully
a
ctlik
ealog
in s h
ell
do not us etherea
dlineli
br
a
ry
to re
a
d commands
w hen
i
nte
r
a
c
ti
ve
do not r
ea
d any of the
i
nitia
li
za
tion
f
i
l
es.
Se
e
I
nvoca
t
i
onAndSta
r
tup,
below
do not r
e
a
d
/
.
ba
sh
rc i
f
i
nte
r
a
c
ti
ve.SeeI
nvoca
t
i
on And
Sta
r
tup,
below
f
ollow the I
EEE POSIX 1
0
0
3.
2
sta
nda
r
d
use f
i
l
ei
ns te
a
d of
/
.
ba
sh
rc i
f
i
nte
r
a
c
ti
ve
sa
mea
s
sa
mea
s
pr
int versi
on i
nf
or
ma
ti
on on
stdouta
ndexitsucce
ssf
ully

I
NVOCATI
ON A ND STA RTUP(
continued)
3.I
nvok
ed a
s sh:I
nteracti
ve log
in s h
ells rea
d and
execute/
e
tc
/
profileand
/
.
profilei
ftheyex
ist.Th
ese
f
i
les a
re sk
ipped i
f
i
s us ed.I
nteractive
sh
ells e
x
pand $
EN V a
nd executetha
tfi
lei
fit e
x
ists.
Noni
nte
r
a
c
tive sh
ells do not rea
d any sta
rtup f
i
l
es.
Af
terthesta
rtupf
i
l
es a
reexecu
ted,
ba
shente
r
sP
OSI
X
mode.
4.
P
OSI
X mode:W hen sta
rtedw ith
,
inte
r
a
c
tive
sh
ells ex
pand $
EN V a
nd execute the g
i
ven f
i
l
e.N o
oth
e
rsta
rtupfile
sa
reread.
5.
I
nvok
edvi
arshd:I
fr
un f
r
om rshdandnotinvok
eda
s
option sk
i
ps thi
s
sh,
ba
shreads
/
.
ba
sh
rc.
The
ste
p,
andthe
option chang
e
s thef
i
le,
butrshd
us uallydoes not pa
ss theseoptions on to thesh
ellit
invok
es.
I
f$
SH ELLOPTS ex
i
sts i
n theenvir
onment a
t sta
r
tup,
bashenables thegi
venoptions.

PROMPTI
NG
W hen i
nte
r
a
c
ti
ve,ba
sh dis pla
y
s the pr
ima
r
y and
seconda
ry prompt stri
ngs,$
PS1 and $
PS2.bash
ex
pands thef
ollow i
ngesca
pesequences i
n theva
lues
ofthesestr
ings.

\
a
an A SCI
IBELcha
r
a
c
ter(
octa
l0
7
)
\
d
theda
tei
n

W eek
dayMonthDa
y

f
orma
t
\
e
an A SCI
Iesca
pechar
a
c
ter(
octa
l0
33)
\
h
thehostna
meuptothef
irstdot(
.
)
\
H
thef
ullhostname
\
n
anew li
ne
\
r
aca
r
r
ia
g
er
e
turn
\s
thena
meofthesh
ell(
basena
meof$
0
)
\
t
thetimei
n 24hourH H :
MM:
SS f
orma
t
\
T
thetimei
n1
2hourH H :
MM:
SS f
orma
t
f
i
l
e
\
u
theuser

s user
na
me
\
v
theversi
onofba
sh(
e
.
g
.
,
2.
0
2)
\
V
theversi
onandpatc
hleve
lofba
sh(
e
.
g.
,
2.
0
2.
0
)
\
w
thecur
r
entw ork
i
ngdir
ectory
\
W
thebasena
meofthecur
r
entw ork
i
ngdir
ectory
\
!
thehi
storynumberofthi
s command
\
#
thecommandnumberofthi
s command
\
$
a#i
ftheef
f
ectiveUI
Di
s0
,
other
wi
sea$
I
NVOCATI
ON A ND S TA RTUP
@
thetimei
n1
2houra
m/
pm f
orma
t
Ther
ea
r
ef
ivew a
y
s th
a
tba
shr
uns:nor
ma
li
nte
r
a
c
ti
ve, \
\
aba
ck
sla
sh
nor
ma
l noni
nteractive
,a
s sh,i
n POSIX mode,or \
\nnn
thecharactercorrespondi
ngtoocta
lva
luennn
i
nvok
edvi
arshd.
\
[
sta
rtasequenceofnonpr
intingcha
r
a
c
ters
1
.
Nor
ma
li
nte
r
a
c
ti
ve:Log
i
n s hells run commands i
n
\
]
endasequenceofnonpr
intingchar
a
c
ters
/
e
tc
/
profile.Thef
irst of
/
.
bash
_
profile,
/
.
bash
_
log
in,
Theh
istorynumberis thenumberofthecommandi
n
and
/
.
profiletha
tis found i
s e
x
e
cute
d.Thi
s sta
g
ei
s
thehi
storyli
st,w hichma
yi
ncludecommands restore
d
i
s us ed.
sk
i
ppedi
f
f
r
om the hi
story f
i
l
e.The command number is the
Upon logout,
ba
shr
uns
/
.
ba
sh
_
logouti
fite
x
i
sts.
number of thi
s command sta
rti
ng f
r
om the f
irst
un bythecur
r
entinvoca
tion ofthesh
ell.
I
nte
r
a
c
ti
ve nonl
og
i
n s hells e
x
e
cute
/
.
ba
sh
rc,if i
t commandr
ex
i
sts.The
i
f
il
eoption chang
e
s thef
i
l
eth
a
ti
s

.
Thedef
aultva
lueofPS1i
s

us ed.
2.Nor
ma
l noni
nte
r
a
c
ti
ve:Noni
nte
r
a
c
tive sh
ells do
va
r
ia
ble,command,and a
rithmeticsubstitution on the
va
l
ue of $
BA SH _ENV,and i
f the r
e
sult na
mes a
n
ex
i
sti
ngf
i
le,
tha
tf
ilei
se
x
e
cuted.

HI
STORY SUBSTI
TUTI
ON

QUOTI
NG

H istoryex
pansi
on i
s si
mi
la
r to csh
s.I
ti
s enabled by \c
def
a
ult in i
nte
r
a
c
ti
ve sh
ells. H i
story ex
pansi
on
`
.
.
.
`
happens bef
oreth
esh
e
llbreak
s th
ei
nputinto w or
ds, "
.
.
.
"
a
lthough quoti
ng is recognized and quote
d te
x
t i
s
tr
ea
teda
s oneh
i
story

w ord

quotesinglecha
racte
rc
olds ty
lecommands ubstitution
te
x
ttr
e
a
teda
s asi
nglea
r
gument,
double
quotes re
moved;va
ri
a
ble,
commandand
a
rithme
ti
csubstitutions per
f
ormed;
use\toquote$
,
\
,
`
,
a
nd"
li
k
e"
.
.
.
"
,
butloca
letra
nsla
ti
on done
te
x
ttr
e
a
teda
s asi
nglea
r
gument,
si
ngle
quote
s re
moved;tex
tbetw een quotes
lefta
lone,cannoti
nclude
te
x
ttr
e
a
teda
s asi
nglea
r
gument,
$
and
si
nglequote
s re
moved;nos ubstitutions
per
f
ormed;A N SIC andadditiona
l
esca
pesequences processed:

s ubstitute$
H OME
s ubstituteuse
r

sh
omedir
ectory
s ubstitute$
PW D
s ubstitute$
OLD PW D
s ubstitute$
{
DIRSTA CK[
n]
}.A lea
di
ng+
or i
s a
llow ed:negative va
lues count
f
r
om theendofthestack

Ti
ldes ubstitution happens a
f
tera
li
a
s e
x
pansi
on.I
ti
s
done f
or w ords tha
t begi
n w ith and f
or va
r
iable
a
ssi
gnment.

,usingna
me
:inste
a
d ofna
me
Note
:f
or ,=,?,and +
te
sts w hetherna
mei
s set a
nd nonNULL;usi
ngna
me
te
sts onlyw hetherna
mei
s se
t.

I
n var
iableassi
gnments,itis a
lsodoneaf
tera:in the
va
lue.Ti
lde s ubstitution is done as pa
rt of w ord
ex
pansi
on.
Th
i
s mea
ns f
or$
{
na
meopw o
r
d},
wo
r
dw illbe
check
edf
orti
ldes ubstitution,
but onlyi
ftheoper
a
ti
on
requir
es theva
lueofther
ighthandsi
de.

For#
,
#
#
,
%,
%%,
/
,
/
/
,
/
#
,
a
nd/
%,
w hen na
mei
s *or@
or a
n a
rra
yi
ndexed by * or @,the s ubstr
i
ng or
s ubstitutionoper
a
ti
oni
sa
ppli
edtoe
a
chel
ement.

H istory s ubstitution i
s per
f
ormed on history eve
nts,
$
"
.
.
.
"
w hi
chcons i
stofa
n eve
ntde
si
g
na
tor(
w hi
chprevi
ous li
ne

.
.
.

tosta
rtw ith)
,aw ordde
si
g
na
tor(
w hichw ordfrom th
a
t
li
ne to use
,sta
rti
ng w ith zero), a
nd one or more
optiona
lmodi
f
ie
r
s (
w hich pa
rts ofthe w ords to use
)
.
$

.
.
.

Colons sepa
r
a
te the three parts,a
lthough the colon
betw een the event designa
tor a
nd w ord desi
gna
tor
ma
ybeomittedw hen thew orddesi
gna
torbeg
ins w ith

,
$
,
*
,,
or%.
Eachmodi
f
ieri
s sepa
r
a
tedfrom thenext
\
a a
lert(
bell)
\
v
verticalta
b
onew ithacolon.Thehistchars va
r
iablespeci
f
ies the
\
b back
spa
ce
\ddd
octa
lva
lueddd
sta
rtof
historyand qui
cksubstitution cha
racters,a
nd
\
f f
or
mf
eed
\
xh
h
h hexva
lueh
h
h
a
lsothecomment cha
r
a
c
te
rtha
tindi
ca
te
s tha
ttherest
\
n new li
ne
\
\
ba
ck
sla
sh
ofali
nei
s acomment.Theprevi
ous command i
s the
\
r ca
r
r
i
ager
e
turn \
e
esca
pe,
notin A N SIC
def
a
ulteve
ntifnoeve
ntdesi
gna
tori
s suppli
ed.
\
t horiz
onta
lta
b
Theeventdesi
gna
tors a
re:
!
sta
rtahi
storys ubstitution
ALI
A SI
NG
!
n
commandli
nen
a
lia
s na
me
=va
l
ue.
.
.
n
cur
r
entlineminus n (
n previ
ous)
!
!
theprevi
ous command
A li
a
ses a
r
e expanded w hen acommand i
s read,not
!
str
most r
ecent command li
nesta
rti
ngw ith w hen execute
d.A li
a
s na
mes ca
n conta
i
n any nonstr
speci
a
lchar
a
c
te
r,
notj
us t a
lphanume
rics,
ex
ceptf
or=.
!
?str
[
?]
mostrece
ntcommandli
neconta
i
ni
ngstr
A li
a
s ex
pansi
on i
s doneon thef
irstw o
r
dofacommand.
!
#
theentir
ecommandlinety
pedsof
a
r
I
fthela
st cha
racterofth
ereplace
menttex
tis abl
a
nk
,

ol
d
new
qui
cksubstitution:r
epeatla
st command then thenextw ordi
n thecommandlineis check
edf
or
chang
i
ngol
dtonew
a
li
a
s ex
pansion.A li
a
ses ca
n even beused to rede
f
ine
sh
ellk
ey
w or
ds ,
butnotin POSI
X mode.
Thew orddesi
gna
tors a
re:
0
thezero
thw ord(
command na
me)
n
w ordn
BRA CEEXP
A NSI
ON

thef
irsta
rg
ument,
i.
e.
,
w or
done
Brace expansion i
s si
mi
la
r to csh
s.A w ord must
$
thela
sta
rgument
conta
in atlea
st oneunquotedleftbraceandcommato
%
the w ord ma
tched by the most rece
nt be expanded.ba
sh expands the comma
separate
d
!
?str
?se
a
rch
items i
n or
der
,the result is not sorted. Brace
w or
ds xthrou
g
hy
. i
s shortf
or
xy
ex
pansi
ons ma
ybenested.
Forexa
mple:
*
w ords 1
throughth
ela
st(
li
k
e
)
$
mk
dir/
usr/
{
gnu,
loca
l}/
{src,
bin,
lib}
n*
w or
ds nthrou
g
hth
ela
st(
li
k
en )
n
w or
ds nthrou
g
hthenexttola
st
Themodi
f
iers a
re:
e
re
movea
llbutthes uf
f
i
xofaf
i
l
ena
me
g
ma
k
e chang
e
s globally
, us e w ith s
modi
f
ier
,
below
h
re
move the la
st part of a f
i
l
ename,
le
a
vingthe

head

p
pr
intthecommandbutdonot e
x
e
cutei
t
q
quoteth
eg
e
nera
tedte
x
t
r
re
movethela
stsuf
f
i
xofaf
i
l
ena
me
s/
ol
d/
new / s ubstitutenew f
orol
di
n the tex
t.A ny
deli
miter ma
y be used.A n & i
n the
replace
mentmeans theva
lueofol
d.
W ith
emptyol
d,
usela
stol
d,
orthemostr
ece
nt
!
?str
?se
a
rchi
ftherew a
s no previ
ous ol
d
t
re
movea
llbutthela
stpa
rtofaf
i
l
ename,
le
a
vingthe

ta
il

x
quoteth
eg
e
neratedte
x
t,but bre
a
ki
nto
w ords a
tbl
a
nk
s andnew line
&
repea
tth
ela
stsubstitution

VA RI
A BLESUBSTI
TUTI
ON
$
na
me
referencetosh
e
llva
r
iablena
me
$
{na
me}
us ebraces todeli
mitsh
ellva
r
iablena
me
$
{na
me w o
r
d}
us eva
r
ia
blena
mei
fset,
elseusew o
r
d
$
{na
me=w o
r
d}
a
sa
bovebuta
lsosetna
metow o
r
d
$
{na
me?w o
r
d}
usena
mei
fset,
oth
e
rw i
sepr
intw o
r
dand
ex
it(
inte
r
a
c
ti
vesh
ells donote
x
it)
$
{na
me+w o
r
d}
usew o
r
di
fna
meis se
t,
oth
e
rw i
seuse
nothi
ng
$
{
na
me
[
n]}
elementni
n ar
r
a
yna
me
$
{
#
na
me
}
leng
thofshellva
r
ia
blena
me
$
{
#
na
me
[
*
]} numberofe
le
ments i
n ar
r
a
yna
me
$
{
#
na
me
[
@]} numberofe
le
ments i
n ar
r
a
yna
me
$
{na
me
#
p
a
t} re
movesh
orte
stleadings ubstr
i
ng
ofna
methatma
tch
e
sp
a
t
$
{na
me
#
#
p
a
t} re
movelong
estlea
di
ngs ubstr
i
ng
ofna
methatma
tch
e
sp
a
t
$
{na
me
%p
a
t} re
movesh
ortesttra
ili
ngs ubstr
i
ng
ofna
methatma
tch
e
sp
a
t
$
{na
me
%%p
a
t}
re
movelong
esttra
ili
ngs ubstr
ing
ofna
methatma
tch
e
sp
a
t
$
{na
me
:
sta
r
t}
$
{na
me
:
sta
r
t:
l
eng
th
}
l
eng
thcharacters ofna
mesta
rtinga
t
sta
r
t(
countingf
r
om 0
)
;us erestof
va
luei
fnol
eng
th
.
N egativesta
r
t
counts f
rom theend.
I
fna
mei
s *or@
ora
na
rra
yi
ndexedby*or@,
sta
r
t
andl
eng
thindi
ca
tethea
r
r
a
yi
ndexa
nd
countofelements.
sta
r
tandl
eng
thcan
bea
rithme
ti
cex
pressi
ons
$
{na
me
/
pa
tte
r
n/
stri
ng
}
va
lueofna
mew ithf
irstma
tchofpa
tte
r
n
replace
dw ithstr
i
ng
$
{na
me
/
pa
tte
r
n}
va
lueofna
mew ithf
irstma
tchofpa
tte
r
n
dele
te
d
$
{na
me
/
/
pa
tte
r
n/
stri
ng
}
va
lueofna
mew ithever
yma
tchof
pa
tte
r
n replace
dw ithstri
ng
$
{na
me
/
#
pa
tte
r
n/
stri
ng
}
va
lueofna
mew ithma
tchofpa
tte
r
n
replace
dw ithstr
i
ng
;ma
tchmus toccur
a
tbegi
nning
$
{na
me
/
%pa
tte
r
n/
stri
ng
}
va
lueofna
mew ithma
tchofpa
tte
r
n
replace
dw ithstr
i
ng
;ma
tc
hoccurs a
t end

TI
LDE SUBSTI
TUTI
ON

use
r

A RI
TH METI
C EVALUATI
ON
A rithme
tic eva
lua
tion is done w ith the let bui
lti
n
command, the (
(
.
.
.
)
) command and the $
(
(
.
.
.
)
)
ex
pansi
onf
orproduci
ngther
e
sultofa
n expression.
A lla
rithme
ti
cuses longi
nte
g
e
rs.
Use
to g
e
t
inte
g
e
r va
ri
ables.Inte
g
e
r consta
nts lookli
k
e[
ba
se
#
]n
w her
eba
sei
s adeci
ma
lnumberbetw een tw o a
nd 64,
andn i
si
n tha
tba
se.
Thedi
gits a
r
e0
9
,
a
z,
AZ,
_and
@.
A lea
di
ng0or0
xdenoteocta
lorh
e
x
a
deci
ma
l.
The f
ollow i
ng oper
a
tors based on C,w ith the sa
me
precedenceandassoci
a
ti
vity
,
areava
i
lable.
!
*
*
*/
%
<< >>
< <= > >=
== !
=
&

|
&&
|
|
?:

una
ryplus andmi
nus
log
i
ca
landbitw isenegation
ex
ponentia
ti
on (
notin C)
multiply
,
di
vi
de,
modulus
addition,
subtr
a
ction
lef
ts h
if
t,
r
ightshi
f
t
compa
r
isons
equals,
not equa
ls
bitw i
seA N D
bitw i
seXOR
bitw i
seOR
log
i
ca
lA N D,
shortcir
cui
t
log
i
ca
lOR,
shortcir
cui
t
i
nli
neconditiona
l
a
ssignmentopera
tors

Insi
delet,
(
(
.
.
.
)
)
,
and$
(
(
.
.
.
)
)
,
va
r
iablenames donotneed
a$
tog
e
tth
e
irva
lues.

COMMA ND SUBSTI
TUTI
ON
$
(
comma
nd) new f
or
m
`
comma
nd` oldf
or
m
Run comma
nd,s ubstitute the r
e
sults a
s a
r
guments.
Tra
ili
ng new li
nes a
re re
moved.Cha
racters i
n $
IFS
separ
a
tew or
ds (
se
eFi
el
d Spl
i
tti
ng
)
.Thenew f
orm i
s
preferredforsimplerquotingr
ule
s.
$
(
(
e
x
pr
e
ssi
on)
)a
rithme
ti
csubstitution
Thee
x
pr
e
ssi
oni
s eva
lua
ted,a
ndth
eresultis useda
sa
n
a
rg
umenttoth
ecurre
nt command.

PROCESS SUBSTI
TUTI
ON
cmd<(
l
i
st1
)>(
l
i
st2)
Runs l
i
st1and l
i
st2 a
sy
nchronous ly
,w ith stdin and
stdout respecti
velyconnectedviapi
pes usingf
i
f
os or
f
i
les i
n/
dev/
f
d.
Th
esef
i
lena
me
s becomea
r
guments to
cmd,
w hi
chexpects toreadits firsta
rg
ument a
ndw rite
its second.
Thi
s onlyw ork
si
fyouh
a
ve/
dev/
f
dorfifos.

FI
ELD SPLI
TTI
NG
Quoted te
x
t becomes one w ord. Other
wi
se,
occur
r
ences ofa
nychar
a
c
te
ri
n$
IFS sepa
r
a
tew ords.
Multiplew hitespa
cecha
r
a
c
te
r
s tha
ta
rei
n$
IFS donot
deli
mit emptyw ords,w hi
le multiple nonw hite
space
char
a
cte
r
s do.W hen $
IFS i
s not the def
ault va
lue,
sequences of lea
di
ng and tr
a
ili
ng $
IFS w hite
spa
ce
char
a
c
ters a
re re
moved,and pr
inta
ble cha
r
a
c
ters i
n
$
IFS s ur
r
ounded by adj
ace
nt $
IFS w hite
spa
ce
char
a
cte
r
s deli
mit f
ields.I
f$
IFS i
s NULL,ba
shdoes
notdof
ields pli
tti
ng.
8

P
ATTERNS
ma
tchsi
nglecha
r
a
c
te
ri
nf
i
lena
me
ma
tc
h0ormorec
h
a
racters in f
i
l
ename
ma
tchanyofc
h
a
r
s
(
pa
irsepa
ratedbya ma
tch
e
s arang
e
)
ma
tcha
nyex
ceptc
h
a
r
s
ma
tcha
nyex
ceptc
h
a
r
s

PREDEFI
NED VA RI
A BLES

usepositiona
lpa
ra
me
te
rn,
n 9
usepositiona
lpa
ra
me
te
rn
a
llpositiona
lpara
me
ters
a
llpositiona
lpara
me
ters
equi
va
lentto"
$
1
$
2.
.
.
"
[
!
c
h
a
r
s]
equi
va
lentto"
$
1
""
$
2".
.
.
[

c
h
a
r
s]
numberofpositi
ona
lpa
ra
meters
I
f the extglob option to s hopt i
s set,the f
ollow i
ng
options toshellorbyset
ex
tendedma
tch
i
ngf
a
cili
ties ma
ybeused.
$
?
va
luer
e
tur
nedbyla
stcommand
?(
pa
t
l
i
st)
optiona
llyma
tc
hanyofthepatterns
$
$
proce
ss numberofcurrentsh
e
ll
*
(
pa
t
l
i
st)
ma
tc
h0ormoreofanyofthepatterns
$
!
process number ofla
st ba
ck
ground
+
(
pa
t
l
i
st)
ma
tch1
ormoreofanyofthepatterns
cmd
@(
pa
t
l
i
st)
ma
tche
x
a
ctly1
ofa
nyofthepatterns
$
_
name ofpr
og
r
a
m i
n envir
onment a
t
!
(
pa
t
l
i
st)
ma
tchany
thi
ngbut a
nyofthepa
tterns
sta
rtup. Va
lue of la
st positi
ona
l
a
rgumentin la
st command.
Nameof
pa
t
l
i
stis ali
stofoneormorepatterns separatedby|
.
changedma
ilf
i
l
ei
n$
MA I
LPATH
ThePOSI
X [
[
=c=]
]and[
[
.
c.
]
]nota
ti
ons forsa
mew ei
ght $
auto_
r
e
sume ena
ble
s
use
of singlew ord
char
a
cters a
nd colla
ti
ng elements a
re accepte
d.The
commands to ma
tchs toppedj
obs f
or
nota
ti
on [
[
:
cl
a
ss:
]
]def
ines cha
r
a
c
tercla
sse
s:
f
ore
g
roundi
ng.
W ithava
lueofexa
ct,
the w ord must exa
ctly ma
tch the
a
lnum a
lphanumer
i
c low er low er
c
a
se
command use
d tosta
rtthej
ob.
W ith
a
lpha a
lphabetic
print
pr
intable
ava
lueofs ubstring,
thety
pedw or
d
blank spaceorta
b
punct punctua
tion
ca
n beas ubstr
ingofthecommand,
cntrl
control
space w hite
spa
ce
lik
e%?stri
ng
digit
deci
ma
l
upper upper
c
a
se
$
BA SH
f
ullf
i
l
ena
meusedtoi
nvok
ebash
g
raph nonspaces
xdigit hexadeci
ma
l
$
BA SH _ENV
in norma
lnoni
nte
r
a
c
ti
ve sh
ells only
,
Thr
e
es hoptoptions a
f
f
e
ctpa
tter
n ma
tch
i
ng.
va
lue i
s va
r
iable, command and
a
rithme
ti
c substituted f
or pa
th of
dotg
lob
includef
i
les w hosena
mes begi
n w ith.
sta
rtup f
i
le (
Se
e I
nvoca
t
i
on And
nocase
glob ignoreca
sew hen ma
tch
i
ng
Sta
r
tup)
nullglob
re
movepa
tter
ns thatdontma
tch
$
BA SH _VERSION
theversi
onofba
sh
W hen expandi
ng f
i
lena
me
s,.and .
.a
re ignored, $
BA SH _VERSINFO[
0
]
the ma
j
or version number
f
i
lena
me
s ma
tch
i
ngthepatterns i
n$
G LOBIG N OREa
r
e
(
relea
se
)
a
lso i
gnored a
ndalea
di
ng.
must be s uppli
ed i
n the $
BA SH _VERSINFO[
1
]
the mi
nor versi
on number
pa
ttern to ma
tch f
i
lena
me
s tha
t begin w ith ..
(
ve
rsi
on)
H ow eve
r
,setting G LOBIG N ORE ena
bles thedotg
lob $
BA SH _VERSINFO[
2]
thepatchlevel
option.
I
nclude.
*i
n G LOBIG N ORE to g
e
t th
ede
f
ault $
BA SH _VERSINFO[
3]
thebuildversi
on
behavi
or
.
$
BA SH _VERSINFO[
4]
there
lea
sesta
tus
$
BA SH _VERSINFO[
5]
sa
mea
s$
MA CH TYPE
$
CDPATH
se
a
rc
hpa
thforcdcommand
VA RI
A BLEN A MES
DIRSTA CK[
*
] a
rra
y va
r
iable conta
i
ni
ng the pus hd
Va
r
iable na
mes a
re made up of le
tte
r
s,d
i
gits a
nd $
andpopddir
ectorystack
underscore
s.
Theyma
ynot sta
rtw ithadigit.
Therei
s
EN V
in i
nte
r
a
c
tive POSIX modesh
ells,or
no li
miton theleng
thofava
r
ia
blename,
andthec
a
se $
w hen i
nvok
eda
s sh,
va
luei
s va
r
ia
ble,
ofle
tte
r
si
s signi
f
ica
nt.
commandandarithmeticsubstituted
f
orpa
thofsta
rtupf
i
le
VA RI
A BLEASSI
G N MEN T
$
EUI
D
theef
f
ectiveuserid(
rea
donly
)
A ssignments to inte
g
e
r va
ri
ables underg
oa
rithme
ti
c
$
FCED I
T
def
aulteditorforthef
ccommand(
no
eva
luation.Va
ria
b
le a
ssi
gnments h
a
ve one of the
def
a
ultva
lue)
f
ollow i
ngf
orms.
$
FI
G N ORE
colonsepa
ratedli
st ofs uf
f
i
x
es g
i
ving
na
me=w o
r
d setna
metow o
r
d
the set off
i
lena
me
s to i
gnor
ew hen
na
me
[
i
nde
x
]=w o
r
d
doi
ng f
i
lena
me comple
ti
on usi
ng
setelementi
nde
xofa
r
r
a
yna
metow o
r
d
rea
dline
na
me=(
wo
r
d.
.
.
)
$
G LOBIG N ORE colonsepa
ratedlistofpa
tterns g
i
vi
ng
setindexedar
r
a
yna
metow ords
the set off
i
lena
me
s to i
gnor
ew hen
na
me=(
[
num]
=w o
r
d.
.
.
)
doi
ngpa
tternma
tchi
ng
setgi
ven i
ndices ofa
r
r
a
yna
metow ords
$
G ROUPS[
*
]
readonlya
rra
yva
r
iablew ith theli
st
ofgroups theuserbe
long
s to
$
histcha
rs
char
a
c
te
r
s tha
t control cshsty
le
hi
story (
def
ault: !

#
)
. See H i
stor
y
Subst
i
tut
i
on
?
*
[
c
h
a
r
s]

$
n
$
{n}
$
*
$
@
"
$
*
"
"$
@"
$
#

1
0

PREDEFI
NED VA RI
A BLES (
continued)
history number of the cur
r
ent
command
$
H ISTCONTROL w ithava
lue ofignore
spa
ce,do not
enter lines that begi
n w ith s paces
i
nto thehi
storyf
i
le.W ithava
lueof
ignore
dups,do not e
nte
rali
neth
a
t
ma
tches the previ
ous li
ne. Use
ignore
bothtocombi
nebothoptions
$
H ISTFI
LE
w her
ecommandhistor
yi
s store
d
$
H ISTFI
LESIZE ma
x
i
mum numbero
flines to k
eep i
n
$
H ISTFI
LE
$
H ISTIG N ORE colonsepa
r
a
tedli
st ofpa
tterns;i
fthe
cur
r
entlinema
tches a
nyofthem,
the
li
nei
s not enteredi
n thehi
storyf
i
l
e.
& represe
nts th
e la
st hi
story li
ne.
Pa
tterns mustma
tchthew holeli
ne
$
H ISTSIZE
number of pr
evi
ous commands to
k
eepava
ilablew hileba
shis running
$
H OME
homedir
e
ctoryf
orcd command and
va
lueusedf
orti
ldeexpansi
on
$
H OSTFILE
f
i
l
ei
nf
orma
t of/
etc/
hosts to usef
or
hostna
mecomple
ti
on
$
H OSTNA ME
na
meofthecur
r
enthost
$
H OSTTYPE
stri
ngde
scr
ibi
ngthecur
r
enthost
$
IFS
f
ields epa
r
a
tors (
space,
ta
b,
new line)
$
I
G N OREEOF f
or inte
r
a
c
ti
ve sh
ells,the numberof
consecutive EOFs tha
t must be
enteredbe
f
or
ebasha
ctua
llyex
its
$
I
NPUTRC
na
me of rea
dline sta
rtup f
i
le,
over
r
i
des
/
.
inputrc
$
LANG
na
meofc
ur
r
entloca
le
$
LC_ALL
cur
r
entloca
le;overri
des $
LANG and
oth
e
r$
LC_va
r
iables
$
LC_COLLATE cur
r
entloca
lef
or ch
a
ractercolla
ti
on,
i
ncludes sorti
ng results off
ilena
me
ex
pansion
$
LC_CTYPE
cur
r
ent loca
le f
or ch
a
racter cla
ss
f
uncti
ons (
seePa
tter
ns)
$
LC_MESSA G ES cur
r
ent loca
le f
or tra
nsla
ti
ng $
"
.
.
.
"
stri
ngs
$
LINENO
li
nenumberoflinebei
ngexecutedi
n
scr
iptorf
uncti
on
$
MA CH TYPE
astri
ng in G N U cpucompa
ny
sy
ste
m
f
or
ma
t de
scri
bing the ma
chi
ne
r
unni
ngbash
$
MA I
L
na
meofama
ilf
i
l
e,
i
fany
$
MA I
LCHECK
checkf
or ma
il eve
r
y n seconds (
60
def
ault)
$
MA I
LPATH
f
i
l
ena
mes tocheckf
ornew ma
i
l;uses
:se
par
a
tor;f
i
l
e
na
mema
ybef
ollow ed
by ?me
ssa
g
e
; $
_ i
n me
ssa
g
e i
s
ma
tch
e
d ma
il f
i
le na
me.Over
r
i
des
$
MA I
L
$
OLD PW D
previ
ous w ork
i
ngdir
e
ctory
$
OPTA RG
va
lueofla
st a
rgument proce
sse
d by
g
etopts
$
OPTERR
i
f set to 1
,di
s pla
y error messa
ges
f
r
om g
etopts (
de
f
a
ult:1
)
$
OPTIND
i
nde
xofl
a
st a
rgument proce
sse
d by
g
etopts
$
H ISTCMD

1
1

PREDEFI
NED VA RI
A BLES (
cont
i
nued)
$
OSTYPE
$
PATH
$
PIPESTATUS[
*
]

$
PPI
D
$
PROMPT_
COMMA N D
$
PS1
$
PS2
$
PS3
$
PS4
$
PW D
$
RA N DOM
$
REP
LY
$
S ECONDS
$
SH ELL
$
SH ELLOPTS
$
SH LVL
$
TI
MEFORMA T

stri
ng
de
scr
ibi
ng
the
oper
a
ti
ng sy
stem r
unni
ng
bash
commandse
a
rchpa
th
a
rra
yva
r
iable conta
i
ni
ngex
i
t
sta
tus va
lues f
r
om proce
sse
s
i
n themostr
ecentlyexecuted
f
ore
g
roundpi
peli
ne
proce
ss i
dofshell
s parent
command to r
un bef
oree
a
ch
pr
ima
r
yprompt
pr
ima
ry
prompt
stri
ng
(
)
seconda
rypromptstri
ng(
>)
select command pr
ompt
stri
ng(
#
?)
tra
ci
ngpromptstri
ng(
+
)
cur
r
entw ork
i
ngdir
ectory
set e
a
c
hti
meit
s referenced,
set by the se
lect and read
commands
numberofseconds si
nces h
ell
i
nvoca
tion
na
meofthi
s shell
colonse
para
ted li
st of the
ena
bled sh
ell options forset
i
ncre
mented byone f
orea
ch
s ubbash
f
orma
t stri
ng f
or output of
time
k
ey
w ord. Speci
a
l
constr
ucts i
ntroducedby%.
%[
p]
[
l]
R
%[
p]
[
l]
U
%[
p]
[
l]
S
%P
%%

$
TMOUT
$
UI
D

elapsedsecs
userCPU secs
sy
stem C PU secs
CPU percenta
g
e
liter
a
l%

Optiona
lpgi
ves thepr
e
ci
si
on,
thenumberofdig
its a
f
te
rth
e
decima
l poi
nt; it mus t be
betw een 0a
nd 3.Optiona
ll
produces along
er f
orma
t,i
n
thef
or
m MMmSS.
FFs
number of seconds to w a
i
t
dur
ing
prompt
bef
or
e
te
rmi
na
ting
ther
ea
luserid(
rea
donly
)

FUNCTI
ONS
Functi
ons run in thesa
meproce
ss a
s theca
lli
ngscr
ipt,
and sh
a
r
ethe open f
i
l
es a
nd cur
r
ent dir
ectory
.They
access theirpa
ra
me
ters li
k
eascr
ipt,
vi
a$
1
,
$
2 and so
on.
$
0does not change.
re
turn ma
ybeused i
nsidea
f
uncti
on or .scr
ipt.Functions sh
a
r
e tra
ps w ith the
parent scri
pt,ex
cept f
orDEBUG .Functi
ons ma
y be
recursi
ve,
andma
yh
a
veloca
lva
r
iables,
decla
redus i
ng
decla
re,loca
l,ortypese
t.Functi
ons ma
ybeexported
.
intotheenvir
onmentw ith

1
2

I
NPUT/
OUTPUT

CONTROL COMMA N DS

Redir
ections a
re donelef
t tori
ght,a
f
terpi
pes a
rese
t
up.Def
aultf
i
l
edescr
iptors a
restdin andstdout.Fi
l
e
descr
iptors above2 a
rema
rk
edcloseonexec.

!pi
pe
l
i
ne
executepi
pe
l
i
ne
.I
fex
it sta
tus w a
s nonzero,e
x
i
t
zero.
I
fe
x
itsta
tus w a
s zero,e
x
it1
c
a
sew o
r
din [
[
(
]
pa
t1
[
|
pa
t2]
.
.
.
)l
i
st;
;]
.
.
.
esa
c
&>w o
r
d
sendstdoutandstderrtow o
r
d
executel
i
sta
ssoci
a
tedw ithp
a
ttha
tma
tches w o
r
d.
>&w o
r
d
sendstdoutandstderrtow o
r
d
Fi
eld s pli
tti
ngi
s not donef
orw o
r
d.p
a
t is abash
[
n]
<f
i
l
e
usef
i
l
ef
ori
nput
pattern (
se
ePa
tter
ns)
.|i
s us edto indica
tean OR
[
n]
>f
i
l
e
usef
i
l
ef
oroutput
condition.
Us eleadi
ng(i
fc
a
sei
si
ns i
de$
()
[
n]
>|
f
i
l
e
li
k
e>,
butoverri
des noclobber
forna
me[
in w ords];dol
i
st;done
[
n]
>>f
i
l
e
li
k
e>but a
ppendtof
i
l
ei
fite
x
i
sts
sequentia
llya
ssi
gn ea
chw o
r
dtona
mea
ndexecute
[
n]
<>f
i
l
e
open f
i
l
ef
orre
a
d/
w rite(
def
ault:f
d0)
l
i
st.I
f in w ords i
s mi
ssing use the positi
ona
l
[
n]
<&m
dupli
ca
tei
nputf
i
ledescr
iptorfrom m
par
a
me
ters
[
n]
>&m
dupli
ca
teoutpu
tfiled
e
scriptorfrom m
[
f
unc
tion]f
unc(
){l
i
st;}
[
n]
closei
nputf
i
ledescr
iptor
def
inef
uncti
on f
unc,
bodyi
sl
i
st(
seeFunct
i
ons)
[
n]
closeoutputf
i
ledescr
iptor
ifl
i
st1
;then l
i
st2[
;elifl
i
st3;then l
i
st4]
.
.
.
[
;elsel
i
st5];f
i
[
n]
<<w o
r
d
i
f executing l
i
st1r
e
tur
ns successf
ul ex
it sta
tus,
i
nput comes f
r
om thesh
ellscr
ipt;trea
t ali
new ith
executel
i
st2 else.
.
.
wo
r
da
s EOF on i
nput.
I
fanyofw o
r
dis quoted,
no
selectna
me[
in w ords];dol
i
st;done
additiona
lproce
ssi
ngi
s doneon i
nputbythesh
ell.
pr
int amenuofw ords,
pr
omptw ith$
PS3 andreada
Other
wi
se:
linef
r
om stdin,sa
vi
ngitin $
REP
LY.I
ftheli
nei
s
dova
r
iable,
command,
a
rithmeticsubstitutions
the number of one of th
ew ords,se
t na
meto it,
ignoreescapednew li
nes
oth
e
rw i
se set na
meto NULL.Executel
i
st.I
fin
use\toquote\
,
$
,
`
,
a
ndf
irstcha
racterofw o
r
d
w ords is mi
ssing use the positiona
l para
me
ters.
r
d a
sa
bove,
butw ithl
ea
di
ngtabs i
gnor
ed
[
n] w o
bashautoma
ti
ca
llyr
epr
ints themenuattheendof
Of&>and>&,
thef
irst i
s preferred.
I
t is e
q
u
iva
le
nt to
theloop
>w o
r
d2>&1
.
pe
l
i
ne
time[ ]pi
execute pi
pe
l
i
ne
;pr
int e
lapsed,sy
stem and use
r
times on stderr.
EX ECUTI
ON ORDER
pr
intti
mes i
n POSI
Xf
orma
t
A ll s ubstitutions a
nd I
/
O r
edir
ections a
re performed
The$
TI
MEFORMA T va
r
ia
blecontrols thef
orma
tof
bef
oreacommandi
sa
ctua
llyexecuted.
theoutputif
is not us ed.
ba
shuses thevalue
$

\
nrea
l\t%3lR\
nuser\t%3lU\
nsys\t%3lSi
ftherei
s
ba
sh ma
i
nta
ins a
n inte
rna
l has h ta
ble f
or cach
i
ng
novaluef
or$
TI
MEFORMA T
ex
te
rna
l commands.I
nitia
lly
,this table i
s empty
.
As
i
st1
;dol
i
st2;done
commands a
refoundbyse
a
rchi
ngthedir
ectori
es li
sted untill
lik
ew hilebutnegatethete
rmina
tionte
st
i
n$
PATH ,
theya
readdedtothehas hta
ble.
w hilel
i
st1
;dol
i
st2;done
Thecommandse
a
rchorderis shellf
uncti
ons first,
bui
ltexecute l
i
st1
.I
f la
st command i
n l
i
st1had a
i
n commands second,a
ndexte
rna
lcommands (
f
irst i
n
successf
ul ex
it sta
tus,e
x
e
cute l
i
st2 f
ollow ed by
theinte
rna
lhas htable,
andthen vi
a$
PATH )thir
d.
l
i
st1
.Repeatuntilla
st commandi
nl
i
st1r
e
turns a
n
unsuccessf
ulex
itsta
tus
(
(
.
.
.
)
)
SI
G N A LS A ND TRAPS
a
rithme
ticeva
lua
tion,
li
k
ele
t"
.
.
.
"
Signa
lhandli
ngi
s donew iththetra
pbui
lti
n command.
[
[
e
x
pr
e
ssi
on]
]
Thew o
r
da
rgument descr
ibi
ng code to execute upon
eva
lua
tee
x
pr
e
ssi
on,r
e
tur
n success f
ulex
itsta
tus i
f
rece
i
pt of the si
gna
li
s scanned tw i
ce byba
sh;once
true, unsuccessf
ul i
f f
a
lse (
see Condi
t
i
ona
l
w hen thetra
p commandis e
x
e
cuted,a
nd a
g
a
i
n w hen
Expr
e
ssi
ons f
orde
ta
i
ls)
thesi
gna
lis caught.Thereforeit is b
e
st tousesing
le
(
l
i
st)
quote
s f
orthetra
p command.Tra
ps a
re execu
tedi
n
executel
i
stin as ubsh
ell
orderofsi
gna
lnumber
.Youca
nnot changethesta
tus
i
st;}
ofasi
gna
ltha
tw a
si
gnoredw hen thesh
ellsta
rtedup. {l
executel
i
stin thecur
r
entshell
Traps on DEBUG happen af
tercommands a
reexecu
ted.
Back
grounded commands (
those f
ollow ed by&)w ill
i
gnoreth
eSIG I
N T andSIG QUI
T signa
ls i
fthemonitor
option i
s tur
nedof
f
.
Other
wi
se,
theyi
nhe
rittheva
lues
ofthepar
entba
sh.

A RRAYS
Ar
r
a
y
s i
n bash h
a
ve no li
mits on the number of
elements.A r
r
a
yi
ndices sta
rt a
t0
.A r
r
a
ysubscr
ipts
ca
n be a
rithme
ti
c expressi
ons.A r
r
a
y elements need
not be contiguous.ba
sh does not h
a
ve a
ssocia
ti
ve
a
rra
y
s.
1
3

1
4

CON DI
TI
ONA L EXPRESSI
ONS
Us edw iththe[
[
.
.
.
]
]compoundcommand,
w hi
chdoes
notdopattern expansion orw ordspli
tti
ng.

BUI
LTI
N COMMA N DS
These commands a
re execu
ted dir
ectly bythe sh
ell.
A lmosta
llacce
pt toma
rkth
ee
ndofoptions.

tr
uei
fstr
i
ngis notNULL
tr
uei
ff
i
l
eex
i
sts ( is preferred)
tr
uei
ff
i
l
eis ablockdevi
ce
tr
uei
ff
i
l
eis achar
a
c
te
rdevi
ce
tr
uei
ff
i
l
eis adir
ectory
tr
uei
ff
i
l
eex
i
sts
tr
uei
ff
i
l
eis areg
ula
rf
ile
tr
uei
ff
i
l
eha
s se
tg
idbitse
t
tr
uei
ff
i
l
egroupis ef
f
ectivegi
d
tr
uei
ff
i
l
eis asy
mboli
cli
nk
tr
uei
ff
i
l
eha
s stick
ybitse
t
tr
uei
ff
i
l
eis asy
mboli
cli
nk
tr
uei
fstr
i
ngha
s nonzeroleng
th
tr
uei
ff
i
l
eex
i
sts a
ndw a
s modi
f
iedsince
la
stre
a
d
option
tr
uei
foptionis on
f
i
l
e
tr
uei
ff
i
l
eow neris ef
f
ectiveui
d
f
i
l
e
tr
uei
ff
i
l
eis af
i
f
o(
na
medpi
pe)
f
i
l
e
tr
uei
ff
i
l
eis rea
dable
f
i
l
e
tr
uei
ff
i
l
eha
s nonzerosize
f
i
l
e
tr
uei
ff
i
l
eis asock
et
f
i
l
edes
tr
uei
ff
i
l
edes i
s ate
rmi
nal
f
i
l
e
tr
uei
ff
i
l
eha
s se
tuidbitse
t
f
i
l
e
tr
uei
ff
i
l
eis w rita
ble
f
i
l
e
tr
uei
ff
i
l
eis e
x
e
cuta
ble
stri
ng
tr
uei
fstr
i
ngha
s zeroleng
th
f
i
l
e
1 f
il
e
2 tr
uei
ff
i
l
e
1
i
s new e
rth
a
nf
il
e
2orf
i
l
e
2
does notex
ist
i
l
e
2 tr
uei
ff
i
l
e
1
i
s olderthan f
i
l
e
2orf
il
e
2
f
i
l
e
1 f
does notex
ist
f
i
l
e
1 f
i
l
e
2 tr
uei
ff
i
l
e
1
andf
i
l
e
2a
reth
esa
mef
i
le
stri
ng==pa
tte
r
n
tr
uei
fstr
i
ngma
tches pa
tte
r
n
stri
ng!
=pa
tte
r
n
tr
uei
fstr
i
ngdoes notma
tchpa
tte
r
n
stri
ng
1
<stri
ng
2
tr
uei
fstri
ng
1
i
s bef
orestri
ng
2
stri
ng
1
>stri
ng
2
tr
uei
fstri
ng
1
i
sa
f
terstri
ng
2
x
p2 tr
uei
fe
x
p1
equals e
x
p2
e
x
p1 e
e
x
p1
e
x
p2 tr
uei
fe
x
p1
does not equa
le
x
p2
e
x
p1 e
x
p2 tr
uei
fe
x
p1
is le
ss than e
x
p2
e
x
p1 e
x
p2 tr
uei
fe
x
p1
is g
rea
terth
a
ne
x
p2
x
p2 tr
uei
fe
x
p1
is le
ss than orequa
ltoe
x
p2
e
x
p1 e
e
x
p1 e
x
p2 tr
uei
fe
x
p1
is g
r
ea
te
rth
a
nor
equaltoe
x
p2
(
e
x
pr
e
ssi
on) tr
uei
fe
x
pr
e
ssi
oni
s true,
f
org
rouping
!e
x
pr
e
ssi
on
tr
uei
fe
x
pr
e
ssi
oni
sf
a
lse
e
x
p1
&&e
x
p2 tr
uei
fe
x
p1
AND e
x
p2a
r
etrue
e
x
p1
|
|e
x
p2
tr
uei
fe
x
p1
ORe
x
p2i
s true

.
f
i
l
e
source f
i
l
e
read and execute commands f
rom f
i
l
e
.I
f
a
rg
uments,sa
ve and re
store positiona
l pa
ra
ms.
Se
a
rch$
PATH ;i
fnoth
ingf
ound,
looki
n thecur
r
ent
dir
e
ctory
: nullcommand;returns 0e
x
itsta
tus
[ se
ete
st
a
lia
s [ ][
na
me
[
=va
l
ue
].
.
.
]
crea
te a
n ali
a
s.W ith no a
r
guments,pr
int a
ll
a
li
a
ses.
W ithna
me
,
pr
inta
li
a
s va
luef
orna
me
pr
inta
lia
s bef
oree
a
cha
li
a
s
bg[j
obi
d]
putj
obi
din theba
ck
ground
p][
]
bind[ ma
bind[ ma
p][ f
unc][ k
e
y
se
q][ f
unc]
p] f
i
l
e
bind[ ma
bind[ ma
p]k
e
y
se
q:
f
unc
di
s pla
y and/
or modi
f
y rea
dline f
unction a
nd k
ey
bi
ndi
ngs.
Th
esy
nta
xi
s sa
mea
s for
/
.
inputrc
f
i
l
e
readnew bindi
ngs f
rom f
i
l
e
li
stthena
mes ofa
llrea
dlinef
uncti
ons
ma
p us ethek
ey
ma
pma
p
li
strea
dlinef
uncti
ons a
ndbi
ndi
ngs
f
orrer
ea
di
ng
li
strea
dlinef
uncti
ons a
ndbi
ndi
ngs
f
unc sh
ow w hichk
ey
s invok
ef
unc
k
e
y
se
q re
movebindi
ngs f
ork
e
y
se
q
li
strea
dlinek
eysequences a
ndma
cros
f
orrer
ea
di
ng
li
strea
dlinek
eysequences a
ndma
cros
f
unc re
movek
eybi
ndi
ngs f
orf
unc
li
strea
dlineva
r
iablena
mes a
ndva
lues
f
orrer
ea
di
ng
li
strea
dlineva
r
iablena
mes a
ndva
lues
brea
k[
n]
ex
itf
r
om enclosingfor,w hile,untilorse
lectloop.
I
fni
s suppli
ed,
ex
itf
r
om n
thenclosi
ngloop
builtin sh
e
l
l
bui
l
t
i
n [a
r
g
s.
.
.
]
execute sh
e
l
l
bui
l
t
i
n w ith given a
r
g
s and r
e
turn
sta
tus.
Usef
ulf
orthebodyofas hellf
uncti
on th
a
t
redef
ines abuilti
n,
e.
g.
,
cd
cd[ ][
di
r
]
chang
e cur
r
ent dir
ectory to di
r(
$
H OME def
a
ult)
.
Dodir
ectorypaths ea
rchusingva
lueof$
CDPATH
us elog
i
ca
lpa
thf
orcd.
.
,
$
PW D (
def
ault)
us eph
y
si
ca
lpathf
orcd.
.
,
$
PW D
I
fbothareg
ive
n,
thel
a
st oneon thecommandli
ne
w ins
cd [ ]
chang
ecur
r
entdir
ectoryto$
OLDPW D
I
ff
i
l
ei
s/
dev/
f
d/
n,
then,
i
fthereis no/
dev/
f
ddir
ectory
,
command[
]na
me[
a
r
g.
.
.
]
f
i
l
e descr
iptor n is check
ed.Other
wi
se,the r
e
a
l
w ithout or ,
executena
mew ithar
guments a
r
g
/
dev/
f
d/
nf
i
lei
s check
ed.
Linux
,
FreeBSD,
BSD/
OS (
a
nd
us eadef
aultse
a
rc
hpa
th
,not$
PATH
ma
y
be others) re
turn i
nf
o f
or the i
ndica
ted f
i
l
e
pr
int aonew ordde
scri
ptionofna
me
descr
iptor,
inste
a
dofthea
ctual/
dev/
f
ddevicef
i
l
e.
pr
int averbosedescri
ptionofna
me
Both && and |
|a
re short cir
cuit.Opera
nds of continue[
n]
compar
ison oper
a
tors underg
oa
rithme
ti
c eva
lua
tion.
do next itera
ti
on ofenclosi
ngfor,w hile,untilor
For==and!
=,
quotea
nypartofpa
tte
r
n totre
a
t ita
s a
selectloop.I
fn i
s suppli
ed,ite
r
a
ten
thenclosing
stri
ng.
loop
stri
ng
f
i
l
e
f
i
l
e
f
i
l
e
f
i
l
e
f
i
l
e
f
i
l
e
f
i
l
e
f
i
l
e
f
i
l
e
f
i
l
e
f
i
l
e
stri
ng
f
i
l
e

1
5

1
6

BUI
LTI
N COMMA N DS (
cont
i
nued)
decla
re[a
f
Firx][ ][
na
me
[
=va
l
ue
]
]
typese
t[a
f
Firx][ ][
na
me
[
=va
l
ue
]
]
set a
ttri
butes a
nd va
lues of va
r
ia
bles.I
nside
f
uncti
ons,cre
a
tene
w copi
es oftheva
r
iables.
Using
+inste
a
dof tur
ns a
ttri
bute
s of
f
.W ithno na
mes
or a
ttri
bute
s, pr
int eve
r
y va
r
iable
s na
me a
nd
a
ttri
bute
s
na
meis a
n ar
r
a
y
ea
chna
mei
s af
uncti
on
don
tsh
ow f
uncti
on def
initions (
bodi
e
s)
na
meis a
ni
nte
g
e
r;a
rithme
ti
c
eva
lua
tioni
s doneupon assi
gnment
ma
r
kna
me
s rea
donly
ma
r
kna
me
sf
orexport
dirs [
][
+
n][n]
dis pla
ythedir
ectorystack
+
n
s how n
thentryf
r
om lef
t,
n 0
n
s how n
thentr
yf
r
om r
ight,
n 0
clea
rthedir
ectorystack
pr
intalong
erf
orma
tli
sti
ng
pr
intthestackoneentryperline
pr
intthestackoneentr
yperline,
w ith
i
ndexnumber
s
j
ob.
.
.
]
disow n [ ][ ][
w ithno options,removenamedj
obs f
r
om theta
ble
ofa
ctivej
obs
re
moveorma
rk
(
w ith )allj
obs
ma
r
kea
chj
obtonotrece
iveaSIG H UP
w henba
shte
rmi
nate
s
us ew ith toma
rk
j
ustrunni
ngj
obs
echo[
][
w ords]
l
echow ords; is notspecia
ex
pand\
esca
pes (
seee
ch
o(
1
)
)
neve
rexpand\
esca
pes
dontoutputtra
ili
ngnew li
ne
printfi
s moreporta
ble
ena
ble[
][ f
i
l
e
][
na
me.
.
.
]
enable a
nd disa
ble shell bui
lti
ns,or load and
unloa
d new bui
lti
ns f
r
om sh
a
red li
br
a
ry f
i
l
e
s.
Di
sa
bli
ngabui
lti
na
llow s useofadi
skf
i
l
ew iththe
sa
mena
mea
s abui
lti
n
pr
inta
llbuilti
ns ,
w iththeirsta
tus
deleteabui
lti
n loa
dedw ith
f
i
l
e
loa
danew bui
lti
n na
mef
r
om f
i
l
e
di
sa
blena
me
,
orpr
intdi
sa
bledbui
lti
ns
w ithnona
me
s
pr
int ena
bledbui
lti
ns
pr
intonlyPOSIX speci
a
lbuilti
ns
eval[
w ords]
eva
lua
tew ords a
ndexecuteresult
exec[ na
me
][ ][
w ords]
executew ords in pla
c
eofthesh
ell.I
fr
edir
ections
only
,
changethesh
ell
s open f
i
l
es
usena
mef
ora
rg
v[
0
]
clea
rtheenvir
onmentf
ir
st
placea on a
rg
v[
0
](
li
k
el
og
i
n(
1
)
)
I
ftheexecfa
ils,noni
nte
r
a
c
tivesh
ells e
x
it,unle
ss
thes hoptoption execf
a
ili
s set
exit[
n]
ex
itw ithr
e
tur
nvaluen.
Use$
?i
fnon

1
7

BUI
LTI
N COMMA N DS (
cont
i
nued)
export[
][
na
me
[
=va
l
ue
].
.
.
]
w ith no a
r
guments,pr
int na
mes a
nd va
lues of
exporte
dva
r
iables.
Other
w ise,
exportna
me
s tothe
envir
onmentofcommands
na
me
s refertofunctions
stopexporti
ngea
chna
me
pr
intexportbef
oree
a
chva
r
iable
f
c[ e
ditor
]
[ ]
[
f
i
rst[
l
a
st]
]
pr
int arang
eofcommands f
r
om f
i
rsttol
a
stf
r
om la
st
$
H ISTSIZEcommands
r
un e
ditori
fs uppli
ed;i
fnot,
us ef
i
r
stof
$
FCEDI
T,
$
EDITOR,
orvion
commands;e
x
e
cuteresult(
s)
li
ston s ta
ndardoutputi
nste
a
dofediting
don
tpr
intlinenumbers
reverseorderofcommands
[
ol
d=new ][
comma
nd]
s ubstitutenew f
orol
di
n comma
nd(
orla
stcommand
i
fnocomma
nd)andexecutetheresult
f
g[j
obi
d]
putj
obi
din thef
ore
g
round
g
etopts optstr
i
ngna
me[
a
r
g.
.
.
]
parsepa
ra
me
ters a
ndoptions (
seeba
sh
(
1
)
)
i
l
e
][
na
me
]
hash[ ][ f
w ithno a
r
guments,pr
int thehas hta
bleconte
nts,
gi
vinghitcount a
ndf
i
lena
me
f
i
l
e
ente
rf
i
l
ef
orna
mei
n thehas hta
ble
clea
rthei
nte
rna
lhas hta
ble
A ssi
gnmentto$
PATH a
lsoclea
rs thehas hta
ble
help[
pa
tte
r
n]
pr
int help.W ithpa
tte
r
n,pr
int help about a
ll the
commands tha
tma
tchpa
tte
r
n
history[
n]
[
f
i
l
e
]
history[ ]
a
r
g[
.
.
.
]
a
r
g[
.
.
.
]
w ith no options,pr
int the command hi
story
.A n
a
rg
ument ofn pr
ints onlyn li
nes.I
fs uppli
ed,use
f
i
l
ei
nste
a
dof$
H ISTFI
LE
append new hi
stor
yli
nes tohistoryf
i
l
e
clea
rthehi
storylist
readnew hi
storyli
nes in thef
i
l
ei
ntoth
e
i
nte
rna
lhi
storyli
st
per
f
orm hi
storys ubstitution andpr
int
ther
esults
replaceinte
rna
lhi
storyw ithconte
nts of
hi
storyf
i
le
placethea
r
g
si
ntothehi
storylist
f
orla
teruse
w riteth
ei
nte
rna
lhi
storytothef
i
le
j
obs [
][
j
obi
d.
.
.
]
comma
nd[
a
r
g
s.
.
.
]
listinf
orma
ti
on aboutj
obs
a
lsoli
stproce
ss i
d
onlyli
ststoppedorex
itedj
obs
onlyli
stproce
ss groups
onlyli
strunningj
obs
onlyli
ststoppedj
obs
replacea
nyj
obi
di
n thecommandli
ne
w iththecor
r
e
spondingproce
ss g
roupID,
a
ndexecuteth
ecommand
1
8

BUI
LTI
N COMMA N DS (
cont
i
nued)
k
ill[si
g
]j
obi
d.
.
.
k
ill[ si
g
na
me
][ si
g
num]j
obi
d.
.
.
send SI
G TERM or g
i
ven si
gna
l to na
med j
obi
ds.
Signa
ls a
re na
me
s li
sted i
n /
usr/
inc
lude
/
signa
l.
h
w ithorw ithoutthepr
e
f
ix

SI
G

.Stoppedj
obs get
a SIG CON T f
irst i
f si
gi
s either SI
G TERM or
SIG H UP
[
si
g
s.
.
.
]
li
st si
gna
l names a
nd/
or numbers.I
f si
g is a
nume
ri
ca
lex
itsta
tus,pri
ntthesi
gna
ltha
tk
ill
edthe
proce
ss
let a
r
g.
.
.
eva
luateea
cha
r
ga
sa
n arithme
ti
cexpressi
on;e
x
it0
i
fthe la
st e
x
pre
ssi
on w a
s nonzero,1oth
e
rw i
se
(
seeAr
i
th
met
i
cEva
l
ua
t
i
on)
loca
l[
na
me
[
=va
l
ue
].
.
.
]
crea
tev
a
ri
a
bles w ith the given values loca
l to a
f
unction.W ith no operands ,pr
int ali
st ofloca
l
va
r
ia
bles.
Mustbeusedi
ns i
deaf
unction
logout
ex
italog
i
n s hell
+
n][n]
popd[ ][
re
move entri
es f
r
om the dir
ectorystack
.W ith no
a
rg
uments,
r
emovethetope
ntryandcdther
e
+
n
re
moven
thentryf
r
om lef
t,
n 0
n
re
moven
thentryf
r
om r
ight,
n 0
dontchangedir
ectory
printff
orma
t[
a
r
g.
.
.
]
pr
intoutput li
k
eA N SIC printf
,
w ithex
te
nsi
ons
%b
ex
pandesca
pesequences i
n s tr
ings
%q
pr
intquote
dstri
ngtha
tca
nbere
r
e
a
d
For
ma
tconversi
ons a
rereuseda
s needed
di
r
]
pus hd[ ][
+
n][n]
pus hd[ ][
add an entr
y to the dir
ectory stack
.W ith no
a
rguments,
ex
changethetoptw oentr
i
es
+
n
rota
teth
esta
c
k
soth
a
tth
en
th
entryf
r
om lef
ti
sa
tthetop,
n 0
n
rota
teth
esta
c
k
soth
a
tth
en
th
entryf
r
om r
ightis a
tthetop,
n 0
dontchangedir
ectory
di
r
pushdi
ronthestacka
ndcdther
e
pw d[ ]
pr
intw ork
i
ngdir
e
ctoryna
me
pr
intlog
ica
lpa
th(
def
a
ult)
pr
intphy
si
ca
lpa
th
I
fbothareg
i
ven,
thela
st oneon thecommandli
ne
wi
ns
na
me
][ ][ prompt][
na
me
s.
.
.
]
r
e
a
dstdin and assi
gn tona
me
s.$
IFS s pli
ts i
nput.
$
REP
LY is se
ti
fnona
megi
ven.
Exi
t0unless endof
f
i
leencounte
r
e
d
readw ords i
ntoi
ndexedar
r
a
yna
me
userea
dlinei
freadi
ngf
r
om ate
rmi
nal
pr
intprompti
freadi
ngf
r
om ate
rminal
bef
orer
e
a
di
ng
a
t endofli
nedoes notdoli
ne
continua
ti
on

1
9

BUI
LTI
N COMMA N DS (
cont
i
nued)
rea
donly[
][
na
me
=va
l
ue.
.
.
]
ma
r
kna
me
s readonly
;pr
intli
sti
fnona
me
s
ea
chna
memustbea
n ar
r
a
y
ea
chna
memustbeaf
uncti
on
pr
intrea
donlybef
oree
a
chva
r
iable
re
turn [
n]
ex
itf
unctionor.
scr
iptw ithr
e
tur
nvaluen.
W ithno
n,
r
e
tur
n s ta
tus ofla
stcommand.
I
fnotin f
uncti
on
or.
scr
ipt,
pr
inta
nerrormessa
ge
w ords]
set[options][ option][
setf
la
g
sa
ndoptions (
seeOpt
i
ons Toset)
.
w ords set
positiona
lpa
ra
meters
set[
+
options][
+
ooption][
w ords]
unsetf
lag
sa
ndoptions
sh
i
f
t[
n]
rena
mepositiona
lpara
me
te
r
s;$
n+
1
=$
1.
.
.
ndef
aults to1
][
option.
.
.
]
s hopt[
pr
int or ch
a
nge values of shell options.W ith no
a
rguments,
pr
intshelloption i
nf
orma
tion
onlychang
e
options
pr
intse
ttings forre
readi
ng
qui
e
tmode;e
x
itsta
tus indi
ca
te
s
optionsta
tus
se
t(
enable
)gi
venoption;w ithno
options,
pr
intthosetha
ta
rese
t
unse
t(
disa
ble
)gi
venoption;w ithno
options,
pr
intthosetha
ta
reunset
(
SeeOpt
i
ons Tos hopt)
s us pend[ ]
s us pendthesh
elluntilSIG CON T is recei
ved
f
orcesuspensi
on,
eve
nf
orlog
i
n s hell
te
st
eva
luate conditi
ona
l expressi
ons (
see Opt
i
ons To
te
standCondi
t
i
ona
lExpr
e
ssi
ons)
times
pr
inta
c
cumula
tedpr
oce
ss times
wo
r
d][
si
g
s]
tra
p[ ][
execute w o
r
di
f si
gna
l in si
g
s rece
i
ved.si
g
s a
r
e
numbers or signa
l na
mes w ith or w ithout

SI
G

.
W ith no w o
r
d orsi
g
s,pr
int tr
aps.W ith no w o
r
d,
rese
tsi
g
s toe
ntrydef
aults.
I
fw o
r
d
si
g
s
to e
ntrydef
aults.I
fw o
r
dis thenullstring,
ignore
si
g
s.
I
fsi
g
si
s 0orEXI
T,
executew o
r
don exitf
r
om
sh
ell.I
f si
g
s i
s DEBUG ,r
un w o
r
d a
f
ter every
command.
pr
intali
stofsigna
lnames a
nd numbers
pr
inttraps w ithquoti
ng
type[
]na
me.
.
.
descr
ibehow thesh
elli
nte
rpr
e
ts na
me
pr
inta
llpossiblei
nte
rpr
e
ta
ti
ons
ofna
me
pr
intthenameofthef
i
l
etoexecutei
f
na
meis a
n ex
te
rna
lprog
r
a
m
pr
int ak
ey
w ordde
scri
bi
ngna
me

20

BUI
LTI
N COMMA N DS (
cont
i
nued)
ulimit[
ty
pe
][
options][
l
i
mi
t]
setorpr
intper
proce
ss limits
ty
pe(
def
aultis both)
:
har
dli
mi
t
softli
mi
t
options:
a
ll(
dis pla
yonly
)
cor
ef
ilesize

ofda
tasegment
ma
xi
mum f
i
l
esize

ofphy
si
ca
lmemory
ma
xi
mum f
i
l
edescr
iptor+1
sizeofpi
pebuf
f
ers

ofsta
ckseg
ment
cpus econds
ma
xproce
sse
sf
oroneuser

ofvirtualmemor
y
is a
ssumedi
fno options a
r
egi
ven.
Thesizef
or
is i
n 51
2by
teblock
s;theothers a
rei
n s izes of
1
0
24by
te
s
uma
sk[ ][
ma
sk
]
setf
i
lecr
e
a
tion per
missi
ons ma
sktocomplementof
ma
ski
focta
l,
orsy
mboli
cva
luea
s i
n ch
mod.W ith
no a
r
guments,
pr
intcur
r
entma
sk
.
A n octa
lma
ski
s
per
missi
ons to re
move, a sy
mboli
c ma
sk i
s
per
mi
ssi
ons tok
eep
pr
intoutpu
tforre
readi
ng
pr
intcur
r
entma
ski
ns y
mbolicf
orm
una
lia
s [ ][
na
me
s]
re
movea
li
a
ses na
me
s
re
movea
lla
li
a
ses
na
me
s]
unset[ ][
unsetva
ria
bles na
me
s(
sa
mea
s
)
unsetf
uncti
ons na
me
s
unsetva
ria
bles na
me
s
Unsetti
ng LI
N EN O, MA I
LCHECK, OPTARG ,
OPTIND,RA NDOM,SECON DS,TMOUT and _
re
moves their speci
a
l meani
ng, eve
n i
f us ed
a
f
te
rw a
rds
wa
it[
j
obi
d.
.
.
]
wa
itf
orj
obj
obi
d;ifnoj
ob,
wa
itf
ora
llch
ildren

OPTI
ONS TO set
Thesetcommand i
s compli
ca
te
d.H erei
s asumma
ry
.
Use + inste
a
d of to tur
n options of
f
.W ith no
a
rg
uments,set pr
ints the names a
nd va
lues of a
ll
va
r
iables.

set[a
bBCefh
Hk
mnpPtuvx
][ooption.
.
.
][
a
r
g.
.
.
]
automa
ti
ca
llyex
portvar
iables upon
a
ssignment
pr
intj
obcompletion messa
ges
i
mmedi
a
te
ly
,
don
tw a
itf
orne
x
tprompt
ena
blebr
aceexpansi
on(
def
ault)
f
orce>|toover
w ritef
ore
x
istingf
i
l
es
ex
ituponnonzeroexitf
r
om acommand
di
sa
blepa
ttern expans i
on
sa
vecommandloca
tions i
n the
i
nterna
lha
s hta
ble(de
f
ault)
ena
ble!
sty
lehistor
y(
def
a
ult)
placea
llva
r
iablea
ssi
gnments i
n
theenvir
onment(
obsolete)
r
un back
g
roundj
obs i
n theirow n
proce
ss gr
oup,
pr
intamessa
ge
w hen theyex
it;se
ta
u
toma
ti
ca
llyf
or
i
nte
r
a
c
ti
vesh
ells on j
obcontrolsy
stems
readcommands w ithoutexecutingthem
(
i
gnoredi
finte
r
a
c
tive)
se
topti
ons;w ithnoa
r
guments,
pr
int
cur
r
entse
tti
ngs
a
llexport sa
mea
s
braceexpa
nd
sa
mea
s
emacs
usea
ne
ma
c
ssty
leli
ne
editor(
def
ault)
erre
xit
sa
mea
s
ha
sh
a
ll
sa
mea
s
histexpand
sa
mea
s
history
ena
blehi
story
ignoreeof li
k
eI
G N OREEOF=1
0
k
ey
w ord
sa
mea
s
monitor
sa
mea
s
noclobber sa
mea
s
noexec
sa
mea
s
noglob
sa
mea
s
notif
y
sa
mea
s
nounse
t
sa
mea
s
onecmd
sa
mea
s
OPTI
ONS TO te
st
physica
l sa
mea
s
Thete
stcommand,
andits sy
nony
m[
.
.
.
]
,
a
rebui
lti
n to
posix
obeythePOSIX 1
0
0
3.
2
ba
sh.
Thecommandaccepts a
lloftheoptions li
ste
di
n
sta
nda
r
d
theCondi
t
i
ona
lExpr
e
ssi
ons se
ction.
H ow eve
r
,
si
nceitis
pr
ivileged sa
mea
s
acommand,
options a
nda
rguments mustbequote
dto
verbose
sa
mea
s
g
etpr
operbehavi
or
,
a
ndnor
ma
lpa
ttern e
x
pans i
on and
vi
us eavi
sty
lelineeditor
f
ields pli
ttinga
redone.
Pa
renth
e
ses usedf
orgroupi
ng
xtrace
sa
mea
s
must bequoted.A rithme
ti
cexpansi
on i
s not donef
or
don
tr
e
a
d$
EN V,
donotta
k
esh
ell
nume
ri
coper
a
tors,a
nd pa
ttern ma
tchi
ngi
s not done
f
uncti
ons f
rom envir
onment,
andignore
f
or==and!
=.
te
stcompli
e
s w ithPOSI
X.
options i
n$
SH ELLOPTS envir
onment
and
options h
a
ve the f
ollow i
ngmea
ni
ngs,
The
va
r
ia
ble
i
nste
a
doftheones li
stedi
n Condi
t
i
ona
lExpr
e
ssi
ons:
f
ollow thephy
si
ca
ldir
ectorystructur
e
f
orcommands thatchangethedir
ectory
log
ica
lA N D
readandexecuteonecommand,
log
ica
lOR
then exi
t
ma
k
eita
n er
r
ortosubstitutea
n unset
va
r
ia
ble
pr
intinputlines a
s they

r
er
e
a
d

21

22

OPTI
ONS TO set(
cont
i
nued)
pr
intcommands a
s they

r
eexecuted,
precededbyex
pandedvalueof$
PS4.
Outputis quotedforla
terreuse
tur
n of
f , ,
s toplook
i
ngf
orfla
g
s;
anyre
ma
i
ninga
rgs se
tth
e
positiona
lpa
ra
meters
donotchangef
lag
s;setpos iti
ona
l
pa
ra
me
te
r
s from a
rg
umentlist;
w ithnoa
r
g
s,
unsetthepositi
ona
l
pa
r
a
me
ters

OPTI
ONS TO s hopt
Thes hoptcommandsets orunsets anumberofoptions
tha
ta
f
f
ect how bashbeh
a
ves.Th
i
s se
ction descr
ibes
ea
choption
s ef
f
e
ctw hen enabled.
Unle
ss noted,th
e
y
a
rea
lldi
sa
bledbydef
a
ult.
cdable_
vars
tr
ea
ta
na
rgumenttocdtha
tis notadir
e
ctorya
s a
va
r
iablew hoseva
luei
s thedir
ectoryna
me
cds pell
a
tte
mpt to cor
r
ect mi
nor spelli
ng errors i
n
a
rg
uments to cd.Er
r
ors tri
ed a
re tra
nspose
d
char
a
c
ters, a missi
ng character or a
n e
x
tra
char
a
c
te
r.
Onlyobey
edin i
nte
r
a
c
ti
vesh
ells
check
h
a
sh
checktha
tacommandin thehas hta
blestillex
i
sts
bef
oretry
i
ng to e
x
e
cuteit.I
fit does nt,se
a
rch
$
PATH
check
w ins ize
checkthe w i
ndow size a
f
ter each command and
upda
te$
LINES and$
COLUMN S
cmdhist
a
tte
mpttosa
vea
llli
nes ofamultil
i
necommandi
n
thehistoryf
i
l
ea
s oneline,
f
ore
a
syre
editi
ng
dotg
lob
i
nclude f
i
les w hose names begi
n w ith.i
n pa
th
ex
pansi
ons
execfa
il
k
eep noni
nte
r
a
c
ti
vesh
ells f
rom ex
iti
ngw hen exec
f
a
ils
expand_
a
lia
se
s
ex
pand a
li
a
ses a
s descr
ibed i
n Al
i
a
ses.Ena
bled
automa
ti
ca
llyi
n inte
r
a
c
tivesh
ells
extglob
enableth
ee
x
tendedpattern ma
tchi
ngf
a
cili
ties (
see
Pa
tter
ns)
hista
ppend
appendthecur
r
enthi
storyto$
H ISTFI
LEupon exit,
i
nste
a
dofover
w ritingi
t
histreedit
i
fusi
ngrea
dlineandahistor
ys ubstitution f
a
ils,
the
userca
n re
edittheli
ne
histverify
i
f usi
ng rea
dline,loa
d the results of history
s ubstitutioni
ntorea
dlinef
orf
urtherediting
hostcomple
te
i
fusi
ngrea
dline,
attempthost comple
ti
on on w or
d
conta
i
ni
ng@
huponexit
sendSIG H UPtoa
llj
obs w hen ba
shex
its
inte
r
a
c
tive_
comments
i
ni
nte
r
a
c
ti
vesh
ells,aw ordsta
rti
ngw ith#sta
rts a
comment.
Enabledbydef
a
ult
23

OPTI
ONS TO s hopt(
cont
i
nued)
lithist
i
f cmdhist is a
lso enabled, sa
ve multil
i
ne
commands w ithnew li
nes,
notse
mi
colons
ma
ilw a
rn
pr
int aw a
rni
ngmessa
gei
faf
i
lebei
ngcheck
edf
or
ma
il w a
s accessed s i
nce the la
st ti
me it w a
s
check
ed
nocaseglob
do a casei
nsensitive ma
tch w hen expandi
ng
pathna
mes
nullg
lob
re
movepa
tterns th
a
t don
tma
tc
ha
nyf
i
l
e,
ins te
a
d
ofle
a
vi
ngthem unchangedin thecommandli
ne
promptva
rs
do pa
ra
meter expansi
on on the prompt va
ri
ables
bef
oreprintingthem.
Enabledbydef
a
ult
sh
i
f
t_
verbose
pr
int a
n error messa
ge w hen the s h
ift count is
grea
terth
a
n th
enumberofpositiona
lpara
meters
sourcepa
th
use $
PATH to find sh
ellf
i
le
s gi
ven to the.and
sourcecommands.
Ena
bledbydef
ault
SPECI
AL CH A RA CTERS
#
|
;
&
&&
|
|

"
$
()
`
(
(
.
.
.
)
)
$
(
(
.
.
.
)
)
\
\new line

sta
rtofcomment;te
rmi
na
tedbynew line
(
pi
pe)connects tw ocommands
commandsepa
r
a
tor
r
un proce
ss i
n back
ground;de
f
a
ultstdin
f
r
om /
dev/
nulli
fnoj
obcontr
ol
onlyr
un f
ollow i
ngcommandi
fprevi
ous
commandcompletedsuccessf
ully
onlyr
un f
ollow i
ngcommandi
fprevi
ous
commandf
a
iled
enclosestr
ingtobeta
k
en li
tera
lly
enclosestr
ingtoh
a
veva
r
iable,
command
andarithme
ticsubstitutiononly
i
nl
i
necommands ubstitution(
new sty
le)
i
nli
necommands ubstitution(
oldstyle)
a
rithme
ti
ceva
lua
tion,
li
k
ele
t"
.
.
.
"
i
nli
nea
rithme
ti
ceva
lua
tion
tr
ea
tf
ollow i
ngcha
r
a
c
terlitera
lly
li
necontinua
ti
on

JOB I
DS A N D JOB CONTROL
Jobs canberepre
se
nteda
sf
ollow s:
j
obi
d
%%
%+
%?str
%n
%pr
e
f

thej
obidentif
ierforaj
ob,
w here:
cur
r
entj
ob
cur
r
entj
ob
previ
ous j
ob
j
obuni
quelyidentif
iedbystr
j
obnumbern
j
obw hosecommandli
nebegi
ns
w ithpr
e
f

Us ually
,aproce
ss I
D ma
ybe used i
ns te
a
dofaj
obi
d.
Commands tha
t ta
k
eaj
obi
dus ethecur
r
entj
ob i
fno
j
obi
di
s suppli
ed.
Tra
ps on SIG CH LD executew heneveraj
ob comple
te
s.
Thecommands f
gandbga
reonlya
va
i
la
bleon s y
stems
that support j
ob contr
ol.Thi
s i
nclude
s Linux
,BSD
sy
stems,
Sy
stem V Relea
se4,
andmostUNI
X systems.
24

REA DLI
NE
Therea
dlineli
br
a
ryi
mplements commandli
neediti
ng.
By def
a
ult,it provi
des a
n e
ma
c
s editing i
nterfa
c
e
,
a
lthough a vi i
nterfa
c
e is a
va
i
lable.rea
dline i
s
i
niti
a
li
zedeitherf
r
om thef
i
lena
med by$
I
NPUTRC (
i
f
set)
,or from
/
.
inputrc.I
n tha
tf
ile,y
ou ca
n use
conditi
ona
ls, def
ine k
ey bi
ndings for ma
cros a
nd
f
uncti
ons,a
ndse
tva
ria
bles.

REA DLI
NEVA RI
A BLES
Va
r
ia
bles contr
ol di
f
f
er
ent a
spects
behavi
or
.
Yousetav
a
ri
ablew ith

of rea
dline
s

setva
r
ia
bl
eva
l
ue
Unless other
wi
senoted,
va
l
ues h
ould beeitherOn or
Of
f
.Thedescr
iptions below descr
ibetheef
f
ect w hen
the va
r
iable i
s On.Def
ault va
lues a
re sh
ow n i
n
parenth
e
ses.

From thebashleve
l,
thebindcomma
ndallow s y
ou to
add,r
emove a
nd change ma
cro a
nd k
ey bi
ndi
ngs. bellstyle(
audible)
Th
er
ea
r
efi
vei
nputmodemap names tha
t contr
olthe
def
ines how rea
dlines h
ouldr
ingthebell:
a
ction ta
k
e
nf
or e
a
chinput char
a
c
te
r.
Thema
p na
mes
audible
r
ingthebell
a
r
eemacs,emacsstandard,emacsme
ta,emacsc
tlx,
none
neve
rr
i
ngthebell
vi,vi
command,andviinsert.emacs i
s thesa
mea
s
visible
f
la
shthescr
een
emacsstandard,
a
ndviis thesa
mea
s vi
command.
commentbegin (
#
)
ins ert this stri
ng f
or readlinei
nse
rtcomment,
Youchoos ew hi
cheditory
ou pr
ef
erw ith
(
boundtoM#i
ne
ma
c
s modeandto#i
n vimode)
or
in y
our
/
.
bash
rcf
i
l
e,
ora
trunti
me.
comple
tioni
gnore
c
a
se(
Of
f
)
rea
dlineundersta
nds th
ec
h
a
racter na
mes DEL,ESC,
ignoreca
sew hen doingcomple
ti
ons
LFD,
NEW LI
NE,
RET,
RETURN,
RUBOUT,
SP
A CE,
SP
C and comple
tionque
ryitems (
1
0
0
)
TA B.
i
fthenumberofcomple
tion items i
s le
ss than thi
s
va
lue,
placethem i
n thecommandli
ne.
Other
wi
se,
a
sktheuseri
ftheys h
ouldbeshow n
REA DLI
NEDI
RECTI
VES
rtme
ta(
On)
Dir
ectives i
n the.
inputrc f
i
le provi
de conditiona
l and conve
trea
tcha
r
a
c
ters w iththeeighthbitseta
s theme
ta
i
ncludef
a
cili
tie
s simila
rtotheC preproce
ssor
.
versi
on oftheequiva
lentseve
n bitchar
a
cte
r
$
include
disa
b
le
comple
tion (
Of
f
)
i
ncludeaf
i
l
e,
e.
g.
,
asy
stemwi
de/
e
tc/
inputrcf
i
le
donotdocompletion
$
if
editingmode(
emacs)
sta
rt a conditi
ona
l,f
or te
rmina
l or appli
ca
tion
set the initia
l editing mode.Possi
ble va
lues a
r
e
speci
f
icsetti
ngs.
Youca
n te
stthef
ollow i
ng:
emacs orvi
applica
tion= te
sttheappli
ca
tion,
e.
g.
bashorgdb
ena
blek
eypad(
Of
f
)
mode=
te
sttheeditingmode,
e
ma
c
s orvi
a
tte
mpttoenableth
ea
ppli
ca
tion k
ey
pad.
This ma
y
te
rm=
te
stthete
rmi
na
lty
pe
beneededtoma
k
ethea
r
r
ow k
ey
s w ork
expandtilde(
Of
f
)
Theuseofapplica
tion=is optiona
l;e.
g.
,
$
ifBa
sh
a
tte
mptti
ldeexpansi
on a
s pa
rtofw ordcompletion
$
else
inputmeta(
Of
f
)
sta
rtthe

else
pa
rtofaconditi
ona
l
me
ta
f
la
g(
Of
f
)
$
endif
ena
bleei
ghtbitinput.
Thetw ova
r
iablena
mes a
r
e
f
ini
s haconditiona
l
sy
nony
ms
k
eyma
p(
emacs)
REA DLI
NEKEY BI
N DI
NGS
set thecur
r
ent k
e
y
ma
p.
SeeReadl
i
nef
or ali
st of
Key
s bound to ama
cro placethema
cro te
x
ti
nto the
a
llow ed va
lues.The editingmode va
r
iable a
lso
i
nput;k
eys boundtoaf
unction r
un thef
unction.
a
f
f
ects thek
ey
ma
p
ma
rk
dir
ectories (
On)
Youca
n usetheseesca
pesequences i
n bindings:
appenda/
tocompleteddir
ectoryna
mes
\
a
a
ler
t(
bell)
\
r
ca
r
r
i
ager
e
turn
ma
rk
modi
f
iedlines (
Of
f
)
\
b
ba
ck
spa
ce
\
t
horiz
onta
ltab(
TA B)
placea*a
tthef
r
ontofmodi
f
iedhi
storyli
nes
contr
olpr
e
f
ix \
v
verticalta
b
outputmeta(
Of
f
)
\
d
dele
te(
DEL) \
\
ba
ck
sla
sh
pr
int cha
r
a
c
ters w iththeei
ghthbitsetdir
ectly
,
not
\
e
esca
pe(
ESC) \
"
li
ter
a
l"
a
s Mx
\
f
f
or
mf
eed
\

li
ter
a
l
printcomple
tions horizonta
lly(
Of
f
)
me
tapre
fi
x
\
ddd
octa
lva
lueddd
di
s pla
ycomple
ti
ons h
orizonta
lly
,w iththema
tch
e
s
\
n
new li
ne
\
xh
h
h hexva
lueh
h
h
sor
te
da
lphabe
tica
lly
,
i
nste
a
dofverti
ca
llydow n the
screen
Ma
cr
os a
ndf
uncti
on bi
ndi
ngs lookli
k
e:
sh
ow a
lli
f
a
mbiguous (
Of
f
)
ma
cro:
k
e
y
se
q:
"
te
x
t"
immedia
tely li
st w ords w ith multiple possi
ble
f
uncti
on:
k
e
y
se
q:
f
unc
tionna
me
comple
ti
ons,
ins te
a
dofringi
ngthebell
sta
ts (
Of
f
)
Ma
cros h
a
ve quoted te
x
t on th
e right of the colon; visiblew hen li
sti
ng possi
ble comple
ti
ons, append a
f
uncti
ons h
a
ve f
unction na
mes.A k
e
y
se
qi
s eithera
char
a
c
te
rtha
tdenote
s thef
i
le
s ty
pe
si
nglecha
racterorch
a
racterna
me(
sucha
s
)
,
or a quote
d stri
ng of c
ha
r
a
c
ters (
si
ngle or double
quote
s)
.
25

Mor
ei
nf
orma
ti
on aboutrea
dlineca
n bef
oundonl
i
neat
http:
/
/
www.
ssc.
com/
ssc/
bash.
26

You might also like