%!PS-Adobe-3.0
%%Creator: groff version 1.09
%%CreationDate: Thu Feb 16 16:14:38 1995
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
%%+ font Symbol
%%DocumentSuppliedResources: procset grops 1.09 0
%%Pages: 44
%%PageOrder: Ascend
%%Orientation: Portrait
%%EndComments
%%BeginProlog
%%BeginResource: procset grops 1.09 0
/setpacking where{
pop
currentpacking
true setpacking
}if
/grops 120 dict dup begin
/SC 32 def
/A/show load def
/B{0 SC 3 -1 roll widthshow}bind def
/C{0 exch ashow}bind def
/D{0 exch 0 SC 5 2 roll awidthshow}bind def
/E{0 rmoveto show}bind def
/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
/G{0 rmoveto 0 exch ashow}bind def
/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/I{0 exch rmoveto show}bind def
/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
/K{0 exch rmoveto 0 exch ashow}bind def
/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/M{rmoveto show}bind def
/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
/O{rmoveto 0 exch ashow}bind def
/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/Q{moveto show}bind def
/R{moveto 0 SC 3 -1 roll widthshow}bind def
/S{moveto 0 exch ashow}bind def
/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
/SF{
findfont exch
[exch dup 0 exch 0 exch neg 0 0]makefont
dup setfont
[exch/setfont cvx]cvx bind def
}bind def
/MF{
findfont
[5 2 roll
0 3 1 roll
neg 0 0]makefont
dup setfont
[exch/setfont cvx]cvx bind def
}bind def
/level0 0 def
/RES 0 def
/PL 0 def
/LS 0 def
/PLG{
gsave newpath clippath pathbbox grestore
exch pop add exch pop
}bind def
/BP{
/level0 save def
1 setlinecap
1 setlinejoin
72 RES div dup scale
LS{
90 rotate
}{
0 PL translate
}ifelse
1 -1 scale
}bind def
/EP{
level0 restore
showpage
}bind def
/DA{
newpath arcn stroke
}bind def
/SN{
transform
25 sub exch .25 sub exch
round .25 add exch round .25 add exch
itransform
}bind def
/DL{
SN
moveto
SN
lineto stroke
}bind def
/DC{
newpath 0 360 arc closepath
}bind def
/TM matrix def
/DE{
TM currentmatrix pop
translate scale newpath 0 0 .5 0 360 arc closepath
TM setmatrix
}bind def
/RC/rcurveto load def
/RL/rlineto load def
/ST/stroke load def
/MT/moveto load def
/CL/closepath load def
/FL{
currentgray exch setgray fill setgray
}bind def
/BL/fill load def
/LW/setlinewidth load def
/RE{
findfont
dup maxlength 1 index/FontName known not{1 add}if dict begin
{
1 index/FID ne{def}{pop pop}ifelse
}forall
/Encoding exch def
dup/FontName exch def
currentdict end definefont pop
}bind def
/DEFS 0 def
/EBEGIN{
moveto
DEFS begin
}bind def
/EEND/end load def
/CNT 0 def
/level1 0 def
/PBEGIN{
/level1 save def
translate
div 3 1 roll div exch scale
neg exch neg exch translate
0 setgray
0 setlinecap
1 setlinewidth
0 setlinejoin
10 setmiterlimit
[]0 setdash
/setstrokeadjust where{
pop
false setstrokeadjust
}if
/setoverprint where{
pop
false setoverprint
}if
newpath
/CNT countdictstack def
userdict begin
/showpage{}def
}bind def
/PEND{
clear
countdictstack CNT sub{end}repeat
level1 restore
}bind def
end def
/setpacking where{
pop
setpacking
}if
%%EndResource
%%IncludeResource: font Times-Roman
%%IncludeResource: font Times-Bold
%%IncludeResource: font Times-Italic
%%IncludeResource: font Symbol
grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron
/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE
/Times-Roman@0 ENC0/Times-Roman RE
%%EndProlog
%%Page: 1 1
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 12/Times-Bold@0 SF
(An Intr)211.272 123 Q(oduction to the C shell)-.216 E/F2 10
/Times-Italic@0 SF -.55(Wi)264.375 147 S(lliam J).55 E(oy)-.25 E(\(r)
214.11 159 Q -.15(ev)-.37 G(ised for 4.3BSD by Mark Seiden\)).15 E F0
(Computer Science Di)232.85 177 Q(vision)-.25 E
(Department of Electrical Engineering and Computer Science)166.36 189 Q
(Uni)219.725 201 Q -.15(ve)-.25 G(rsity of California, Berk).15 E(ele)
-.1 E(y)-.15 E(Berk)233.875 213 Q(ele)-.1 E 1.3 -.65(y, C)-.15 H
(alifornia 94720).65 E F2(ABSTRA)264.535 249 Q(CT)-.3 E(Csh)133 273 Q F0
1.292(is a ne)5.458 F 3.791(wc)-.25 G 1.291
(ommand language interpreter for)-3.791 F/F3 9/Times-Roman@0 SF(UNIX)
3.791 E F0 3.791<8773>C 3.791(ystems. It)-3.791 F(incorporates)3.791 E
684(good features of other shells and a)108 285 R F2(history)3.184 E F0
684(mechanism similar to the)4.85 F F2 -.37(re)3.184 G(do).37 E F0(of)
4.851 E/F4 8/Times-Roman@0 SF(INTERLISP)3.185 E F0(.)A 1.569
(While incorporating man)108 297 R 4.068(yf)-.15 G 1.568
(eatures of other shells which mak)-4.068 F 4.068(ew)-.1 G 1.568
(riting shell programs)-4.068 F .069(\(shell scripts\) easier)108 309 R
2.569(,m)-.4 G .069(ost of the features unique to)-2.569 F F2(csh)2.57 E
F0 .07(are designed more for the interac-)4.236 F(ti)108 321 Q -.15(ve)
-.25 G F4(UNIX)2.65 E F0(user)2.5 E(.)-.55 E F4(UNIX)133 336.6 Q F0 .484
(users who ha)2.984 F .784 -.15(ve r)-.2 H .483
(ead a general introduction to the system will \214nd a v).15 F(aluable)
-.25 E .292(basic e)108 348.6 R .292(xplanation of the shell here.)-.15
F .293(Simple terminal interaction with)5.293 F F2(csh)2.793 E F0 .293
(is possible after)4.459 F 1.007
(reading just the \214rst section of this document.)108 360.6 R 1.007
(The second section describes the shell')6.007 F(s)-.55 E .803
(capabilities which you can e)108 372.6 R .804(xplore after you ha)-.15
F 1.104 -.15(ve b)-.2 H -.15(eg).15 G .804
(un to become acquainted with the).15 F 2.501(shell. Later)108 384.6 R
001(sections introduce features which are useful, b)2.501 F 0
(ut not necessary for all users of)-.2 F(the shell.)108 396.6 Q .782(Ad\
ditional information includes an appendix listing special characters of\
the shell)133 412.2 R
(and a glossary of terms and commands introduced in this manual.)108
424.2 Q/F5 10/Times-Bold@0 SF(Intr)72 460.2 Q(oduction)-.18 E F0(A)97
475.8 Q F2(shell)3.102 E F0 .601(is a command language interpreter)4.768
F(.)-.55 E F2(Csh)5.601 E F0 .601
(is the name of one particular command interpreter)4.767 F(on)72 487.8 Q
F4(UNIX)2.598 E F0 5.098(.T)C .098(he primary purpose of)-5.098 F F2
(csh)2.598 E F0 .099
(is to translate command lines typed at a terminal into system actions,)
4.264 F .182(such as in)72 499.8 R -.2(vo)-.4 G .182
(cation of other programs.).2 F F2(Csh)5.182 E F0 .182
(is a user program just lik)4.348 F 2.681(ea)-.1 G .481 -.15(ny y)-2.681
H .181(ou might write.).15 F(Hopefully)5.181 E(,)-.65 E F2(csh)2.681 E
F0(will be a v)72 511.8 Q
(ery useful program for you in interacting with the)-.15 E F4(UNIX)2.5 E
F0(system.)2.5 E .867(In addition to this document, you will w)97 527.4
R .867(ant to refer to a cop)-.1 F 3.367(yo)-.1 G 3.367(ft)-3.367 G(he)
-3.367 E F4(UNIX)3.367 E F0 .868(User Reference Manual.)3.367 F(The)72
539.4 Q F2(csh)2.632 E F0 .131
(documentation in section 1 of the manual pro)4.298 F .131
(vides a full description of all features of the shell and)-.15 F
(is the de\214niti)72 551.4 Q .3 -.15(ve r)-.25 H
(eference for questions about the shell.).15 E(Man)97 567 Q 2.768(yw)
-.15 G .269(ords in this document are sho)-2.868 F .269(wn in)-.25 F F2
(italics.)2.769 E F0 .269(These are important w)4.435 F .269
(ords; names of commands,)-.1 F .309(and w)72 579 R .309(ords which ha)
-.1 F .609 -.15(ve s)-.2 H .308
(pecial meaning in discussing the shell and).15 F F4(UNIX)2.808 E F0
5.308(.M)C(an)-5.308 E 2.808(yo)-.15 G 2.808(ft)-2.808 G .308(he w)
-2.808 F .308(ords are de\214ned in)-.1 F 2.907(ag)72 591 S .407
(lossary at the end of this document.)-2.907 F .407(If you don')5.407 F
2.907(tk)-.18 G(no)-2.907 E 2.907(ww)-.25 G .407(hat is meant by a w)
-2.907 F .408(ord, you should look for it)-.1 F(in the glossary)72 603 Q
(.)-.65 E F5(Ackno)72 627 Q(wledgements)-.1 E F0 .859
(Numerous people ha)97 642.6 R 1.159 -.15(ve p)-.2 H(ro).15 E .858
(vided good input about pre)-.15 F .858(vious v)-.25 F .858(ersions of)
-.15 F F2(csh)3.358 E F0 .858(and aided in its deb)5.024 F(ug-)-.2 E
355(ging and in the deb)72 654.6 R .356(ugging of its documentation.)
-.2 F 2.856(Iw)5.356 G .356(ould especially lik)-2.956 F 2.856(et)-.1 G
2.856(ot)-2.856 G .356(hank Michael Ubell who made)-2.856 F .202
(the crucial observ)72 666.6 R .201
(ation that history commands could be done well o)-.25 F -.15(ve)-.15 G
2.701(rt).15 G .201(he w)-2.701 F .201(ord structure of input te)-.1 F
201(xt, and)-.15 F .042
(implemented a prototype history mechanism in an older v)72 678.6 R .043
(ersion of the shell.)-.15 F .043(Eric Allman has also pro)5.043 F
(vided)-.15 E 3.165(al)72 690.6 S(ar)-3.165 E .665(ge number of useful \
comments on the shell, helping to unify those concepts which are presen\
t and to)-.18 F .32 LW 76 700.6 72 700.6 DL 80 700.6 76 700.6 DL 84
700.6 80 700.6 DL 88 700.6 84 700.6 DL 92 700.6 88 700.6 DL 96 700.6 92
700.6 DL 100 700.6 96 700.6 DL 104 700.6 100 700.6 DL 108 700.6 104
700.6 DL 112 700.6 108 700.6 DL 116 700.6 112 700.6 DL 120 700.6 116
700.6 DL 124 700.6 120 700.6 DL 128 700.6 124 700.6 DL 132 700.6 128
700.6 DL 136 700.6 132 700.6 DL 140 700.6 136 700.6 DL 144 700.6 140
700.6 DL F4<87>72 710.6 Q/F6 7/Times-Roman@0 SF(UNIX)2 E F4
(is a trademark of Bell Laboratories.)2 E EP
%%Page: 2 2
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 273.67(USD:4-2 An)72 52 R
(Introduction to the C shell)2.5 E .287
(identify and eliminate useless and mar)72 84 R .288
(ginally useful features.)-.18 F(Mik)5.288 E 2.788(eO)-.1 G .288
('Brien suggested the pathname hash-)-2.788 F 1.568
(ing mechanism which speeds command e)72 96 R -.15(xe)-.15 G 4.068
(cution. Jim).15 F -.15(Ku)4.068 G 1.568
(lp added the job control and directory stack).15 F(primiti)72 108 Q
-.15(ve)-.25 G 2.5(sa).15 G
(nd added their documentation to this introduction.)-2.5 E EP
%%Page: 3 3
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-3)276.17 E/F1 10
/Times-Bold@0 SF 2.5(1. T)72 84 R(erminal usage of the shell)-.92 E 2.5
(1.1. The)72 108 R(basic notion of commands)2.5 E F0(A)97 123.6 Q/F2 10
/Times-Italic@0 SF(shell)2.814 E F0(in)4.48 E/F3 8/Times-Roman@0 SF
(UNIX)2.814 E F0 .315(acts mostly as a medium through which other)2.814
F F2(pr)2.815 E -.1(og)-.45 G -.15(ra).1 G(ms).15 E F0 .315(are in)4.481
F -.2(vo)-.4 G -.1(ke).2 G 2.815(d. While).1 F .315(it has a)2.815 F
131(set of)72 135.6 R F2 -.2(bu)2.631 G(iltin).2 E F0 .131
(functions which it performs directly)4.297 F 2.631(,m)-.65 G .131
(ost commands cause e)-2.631 F -.15(xe)-.15 G .131
(cution of programs that are, in).15 F -.1(fa)72 147.6 S .646(ct, e).1 F
647(xternal to the shell.)-.15 F .647(The shell is thus distinguished \
from the command interpreters of other systems)5.647 F .412
(both by the f)72 159.6 R .412
(act that it is just a user program, and by the f)-.1 F .412
(act that it is used almost e)-.1 F(xclusi)-.15 E -.15(ve)-.25 G .411
(ly as a mecha-).15 F(nism for in)72 171.6 Q -.2(vo)-.4 G
(king other programs.).2 E F2(Commands)97 187.2 Q F0 .583(in the)4.748 F
F3(UNIX)3.083 E F0 .583(system consist of a list of strings or)3.083 F
F2(wor)3.083 E(ds)-.37 E F0 .583(interpreted as a)4.749 F F2 .583
(command name)3.083 F F0(follo)72 199.2 Q(wed by)-.25 E F2(ar)2.5 E
(guments.)-.37 E F0(Thus the command)4.166 E(mail bill)108 217.2 Q .579
(consists of tw)72 235.2 R 3.078(ow)-.1 G 3.078(ords. The)-3.178 F .578
(\214rst w)3.078 F(ord)-.1 E F2(mail)3.078 E F0 .578
(names the command to be e)4.744 F -.15(xe)-.15 G .578
(cuted, in this case the mail pro-).15 F 1.574
(gram which sends messages to other users.)72 247.2 R 1.575
(The shell uses the name of the command in attempting to)6.575 F -.15
(exe)72 259.2 S .005(cute it for you.).15 F .005
(It will look in a number of)5.005 F F2(dir)2.504 E(ectories)-.37 E F0
004(for a \214le with the name)4.17 F F2(mail)2.504 E F0 .004
(which is e)4.17 F .004(xpected to)-.15 F(contain the mail program.)72
271.2 Q 1.551(The rest of the w)97 286.8 R 1.551
(ords of the command are gi)-.1 F -.15(ve)-.25 G 4.051(na).15 G(s)-4.051
E F2(ar)4.051 E(guments)-.37 E F0 1.552
(to the command itself when it is)5.717 F -.15(exe)72 298.8 S 3.136
(cuted. In).15 F .636(this case we speci\214ed also the ar)3.136 F
(gument)-.18 E F2(bill)3.135 E F0 .635(which is interpreted by the)4.801
F F2(mail)3.135 E F0 .635(program to be)4.801 F .401
(the name of a user to whom mail is to be sent.)72 310.8 R .402
(In normal terminal usage we might use the)5.402 F F2(mail)2.902 E F0
(command)4.568 E(as follo)72 322.8 Q(ws.)-.25 E 2.5(%m)108 340.8 S
(ail bill)-2.5 E 2.5(Ih)108 352.8 S -2.25 -.2(av e)-2.5 H 2.5(aq)2.7 G
(uestion about the csh documentation.)-2.5 E
(My document seems to be missing page 5.)108 364.8 Q(Does a page \214v)
108 376.8 Q 2.5(ee)-.15 G(xist?)-2.65 E(Bill)133 388.8 Q(EO)108 400.8 Q
(T)-.4 E(%)108 412.8 Q .387(Here we typed a message to send to)97 434.4
R F2(bill)2.887 E F0 .387
(and ended this message with a ^D which sent an end-of-\214le)4.553 F
427(to the mail program.)72 446.4 R .428
(\(Here and throughout this document, the notation `)5.427 F(`^)-.74 E
F2(x)A F0 1.908 -.74('' i)D 2.928(st).74 G 2.928(ob)-2.928 G 2.928(er)
-2.928 G .428(ead `)-2.928 F(`control-)-.74 E F2(x)A F0 1.908 -.74('' a)
D(nd).74 E .31(represents the striking of the)72 458.4 R F2(x)2.81 E F0
-.1(ke)2.81 G 2.81(yw)-.05 G .31(hile the control k)-2.81 F .609 -.15
(ey i)-.1 H 2.809(sh).15 G .309(eld do)-2.809 F 2.809(wn.\) The)-.25 F
309(mail program then echoed the)2.809 F .436(characters `EO)72 470.4 R
437(T' and transmitted our message.)-.4 F .437
(The characters `% ' were printed before and after the mail)5.437 F
(command by the shell to indicate that input w)72 482.4 Q(as needed.)-.1
E .844(After typing the `% ' prompt the shell w)97 498 R .844
(as reading command input from our terminal.)-.1 F 2.444 -.8(We t)5.844
H .844(yped a).8 F 1.261(complete command `mail bill'.)72 510 R 1.261
(The shell then e)6.261 F -.15(xe)-.15 G 1.261(cuted the).15 F F2(mail)
3.761 E F0 1.261(program with ar)5.427 F(gument)-.18 E F2(bill)3.762 E
F0 1.262(and went)5.428 F .306(dormant w)72 522 R .306
(aiting for it to complete.)-.1 F .306
(The mail program then read input from our terminal until we signalled)
5.306 F .562(an end-of-\214le via typing a ^D after which the shell not\
iced that mail had completed and signaled us that it)72 534 R -.1(wa)72
546 S 2.5(sr).1 G(eady to read from the terminal ag)-2.5 E
(ain by printing another `% ' prompt.)-.05 E .753
(This is the essential pattern of all interaction with)97 561.6 R F3
(UNIX)3.252 E F0 .752(through the shell.)3.252 F 3.252(Ac)5.752 G .752
(omplete command is)-3.252 F .499(typed at the terminal, the shell e)72
573.6 R -.15(xe)-.15 G .499(cutes the command and when this e).15 F -.15
(xe)-.15 G .5(cution completes, it prompts for a).15 F(ne)72 585.6 Q
3.07(wc)-.25 G 3.07(ommand. If)-3.07 F .57
(you run the editor for an hour)3.07 F 3.07(,t)-.4 G .57
(he shell will patiently w)-3.07 F .57
(ait for you to \214nish editing and)-.1 F(obediently prompt you ag)72
597.6 Q(ain whene)-.05 E -.15(ve)-.25 G 2.5(ry).15 G
(ou \214nish editing.)-2.5 E .593(An e)97 613.2 R .594
(xample of a useful command you can e)-.15 F -.15(xe)-.15 G .594
(cute no).15 F 3.094(wi)-.25 G 3.094(st)-3.094 G(he)-3.094 E F2(tset)
3.094 E F0 .594(command, which sets the def)4.76 F(ault)-.1 E F2(er)72
625.2 Q(ase)-.15 E F0(and)4.536 E F2(kill)2.87 E F0 .369(characters on \
your terminal \255 the erase character erases the last character you ty\
ped and the)4.536 F .242(kill character erases the entire line you ha)72
637.2 R .542 -.15(ve e)-.2 H .242(ntered so f).15 F(ar)-.1 E 5.242(.B)
-.55 G 2.742(yd)-5.242 G(ef)-2.742 E .242
(ault, the erase character is the delete k)-.1 F -.15(ey)-.1 G(\(equi)72
649.2 Q -.25(va)-.25 G 1.599(lent to `^?'\)).25 F 1.599
(and the kill character is `^U'.)6.599 F 1.599
(Some people prefer to mak)6.599 F 4.099(et)-.1 G 1.598
(he erase character the)-4.099 F(backspace k)72 661.2 Q .3 -.15(ey \()
-.1 H(equi).15 E -.25(va)-.25 G(lent to `^H'\).).25 E -1.1(Yo)5 G 2.5
(uc)1.1 G(an mak)-2.5 E 2.5(et)-.1 G(his be true by typing)-2.5 E
(tset \255e)108 679.2 Q 2.661(which tells the program)72 697.2 R F2
(tset)5.161 E F0 2.661(to set the erase character to tset')6.827 F 5.162
(sd)-.55 G(ef)-5.162 E 2.662(ault setting for this character \(a)-.1 F
(backspace\).)72 709.2 Q EP
%%Page: 4 4
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 273.67(USD:4-4 An)72 52 R
(Introduction to the C shell)2.5 E/F1 10/Times-Bold@0 SF 2.5(1.2. Flag)
72 84 R(ar)2.5 E(guments)-.1 E F0 2.804(Au)97 99.6 S .303
(seful notion in)-2.804 F/F2 8/Times-Roman@0 SF(UNIX)2.803 E F0 .303
(is that of a)2.803 F/F3 10/Times-Italic@0 SF<8d61>2.803 E(g)-.1 E F0
(ar)4.469 E 2.803(gument. While)-.18 F(man)2.803 E 2.803(ya)-.15 G -.18
(rg)-2.803 G .303(uments to commands specify \214le).18 F 1.335
(names or user names, some ar)72 111.6 R 1.335
(guments rather specify an optional capability of the command which you)
-.18 F(wish to in)72 123.6 Q -.2(vo)-.4 G -.1(ke).2 G 5(.B).1 G 2.5(yc)
-5 G(on)-2.5 E -.15(ve)-.4 G(ntion, such ar).15 E(guments be)-.18 E
(gin with the character `\255' \(h)-.15 E 2.5(yphen\). Thus)-.05 F
(the command)2.5 E(ls)108 141.6 Q
(will produce a list of the \214les in the current)72 159.6 Q F3
(working dir)2.5 E(ectory)-.37 E F0 5(.T)1.666 G(he option)-5 E F3<ad73>
2.5 E F0(is the size option, and)4.166 E(ls \255s)108 177.6 Q(causes)72
195.6 Q F3(ls)2.989 E F0 .489(to also gi)4.655 F -.15(ve)-.25 G 2.989
(,f).15 G .489
(or each \214le the size of the \214le in blocks of 512 characters.)
-2.989 F .488(The manual section for)5.488 F .67(each command in the)72
207.6 R F2(UNIX)3.17 E F0 .671(reference manual gi)3.171 F -.15(ve)-.25
G 3.171(st).15 G .671(he a)-3.171 F -.25(va)-.2 G .671
(ilable options for each command.).25 F(The)5.671 E F3(ls)3.171 E F0
(com-)4.837 E .103(mand has a lar)72 219.6 R .103
(ge number of useful and interesting options.)-.18 F .103
(Most other commands ha)5.103 F .403 -.15(ve e)-.2 H .103
(ither no options or).15 F .488(only one or tw)72 231.6 R 2.988(oo)-.1 G
2.988(ptions. It)-2.988 F .488
(is hard to remember options of commands which are not used v)2.988 F
489(ery frequently)-.15 F(,)-.65 E 1.53(so most)72 243.6 R F2(UNIX)4.03
E F0 1.53(utilities perform only one or tw)4.03 F 4.03(of)-.1 G 1.53
(unctions rather than ha)-4.03 F 1.53(ving a lar)-.2 F 1.53
(ge number of hard to)-.18 F(remember options.)72 255.6 Q F1 2.5
(1.3. Output)72 279.6 R(to \214les)2.5 E F0 .979(Commands that normally\
read input or write output on the terminal can also be e)97 295.2 R
-.15(xe)-.15 G .98(cuted with this).15 F
(input and/or output done to a \214le.)72 307.2 Q
(Thus suppose we wish to sa)97 322.8 Q .3 -.15(ve t)-.2 H
(he current date in a \214le called `no).15 E 2.5(w'. The)-.25 F
(command)2.5 E(date)108 340.8 Q .572
(will print the current date on our terminal.)72 358.8 R .572
(This is because our terminal is the def)5.572 F(ault)-.1 E F3(standar)
3.072 E 3.071(do)-.37 G(utput)-3.071 E F0(for)4.737 E .587(the date com\
mand and the date command prints the date on its standard output.)72
370.8 R .587(The shell lets us)5.587 F F3 -.37(re)3.087 G(dir).37 E(ect)
-.37 E F0(the)72 382.8 Q F3(standar)2.739 E 2.739(do)-.37 G(utput)-2.739
E F0 .239(of a command through a notation using the)4.405 F F3(metac)
2.739 E(har)-.15 E(acter)-.15 E F0 .238(`>' and the name of the \214le)
4.405 F(where output is to be placed.)72 394.8 Q(Thus the command)5 E
(date > no)108 412.8 Q(w)-.25 E .898(runs the)72 430.8 R F3(date)3.398 E
F0 .898(command such that its standard output is the \214le `no)5.064 F
899(w' rather than the terminal.)-.25 F .899(Thus this)5.899 F .705
(command places the current date and time into the \214le `no)72 442.8 R
3.204(w'. It)-.25 F .704(is important to kno)3.204 F 3.204(wt)-.25 G
704(hat the)-3.204 F F3(date)3.204 E F0(com-)4.87 E .555(mand w)72
454.8 R .555(as una)-.1 F -.1(wa)-.15 G .555(re that its output w).1 F
556(as going to a \214le rather than to the terminal.)-.1 F .556
(The shell performed this)5.556 F F3 -.37(re)72 466.8 S(dir).37 E
(ection)-.37 E F0(before the command be)4.166 E -.05(ga)-.15 G 2.5(ne)
05 G -.15(xe)-2.65 G(cuting.).15 E .959
(One other thing to note here is that the \214le `no)97 482.4 R .959
(w' need not ha)-.25 F 1.259 -.15(ve ex)-.2 H .959(isted before the).15
F F3(date)3.459 E F0(command)5.125 E -.1(wa)72 494.4 S 3.44(se).1 G -.15
(xe)-3.59 G .941(cuted; the shell w).15 F .941(ould ha)-.1 F 1.241 -.15
(ve c)-.2 H .941(reated the \214le if it did not e).15 F 3.441
(xist. And)-.15 F .941(if the \214le did e)3.441 F 3.441(xist? If)-.15 F
941(it had)3.441 F -.15(ex)72 506.4 S .574(isted pre).15 F .574
(viously these pre)-.25 F .573(vious contents w)-.25 F .573(ould ha)-.1
F .873 -.15(ve b)-.2 H .573(een discarded!).15 F 3.073(As)5.573 G .573
(hell option)-3.073 F F3(noclobber)3.073 E F0 -.15(ex)4.739 G .573
(ists to).15 F(pre)72 518.4 Q -.15(ve)-.25 G
(nt this from happening accidentally; it is discussed in section 2.2.)
15 E .275(The system normally k)97 534 R .275
(eeps \214les which you create with `>' and all other \214les.)-.1 F
275(Thus the def)5.275 F .275(ault is for)-.1 F .693
(\214les to be permanent.)72 546 R .693
(If you wish to create a \214le which will be remo)5.693 F -.15(ve)-.15
G 3.192(da).15 G(utomatically)-3.192 E 3.192(,y)-.65 G .692(ou can be)
-3.192 F .692(gin its)-.15 F .548(name with a `#' character)72 558 R
3.048(,t)-.4 G .547(his `scratch' character denotes the f)-3.048 F .547
(act that the \214le will be a scratch \214le.*)-.1 F(The)5.547 E .819
(system will remo)72 570 R 1.119 -.15(ve s)-.15 H .819(uch \214les afte\
r a couple of days, or sooner if \214le space becomes v).15 F .82
(ery tight.)-.15 F .82(Thus, in)5.82 F .13(running the)72 582 R F3(date)
2.63 E F0 .13(command abo)4.296 F -.15(ve)-.15 G 2.63(,w).15 G 2.63(ed)
-2.63 G(on')-2.63 E 2.63(tr)-.18 G .13(eally w)-2.63 F .13(ant to sa)-.1
F .43 -.15(ve t)-.2 H .13(he output fore).15 F -.15(ve)-.25 G .929 -.4
(r, s).15 H 2.629(ow).4 G 2.629(ew)-2.629 G .129(ould more lik)-2.729 F
(ely)-.1 E(do)72 594 Q(date > #no)108 612 Q(w)-.25 E .32 LW 76 668 72
668 DL 80 668 76 668 DL 84 668 80 668 DL 88 668 84 668 DL 92 668 88 668
DL 96 668 92 668 DL 100 668 96 668 DL 104 668 100 668 DL 108 668 104 668
DL 112 668 108 668 DL 116 668 112 668 DL 120 668 116 668 DL 124 668 120
668 DL 128 668 124 668 DL 132 668 128 668 DL 136 668 132 668 DL 140 668
136 668 DL 144 668 140 668 DL F2 .317
(*Note that if your erase character is a `#', you will ha)72 678 R .557
-.12(ve t)-.16 H 2.318(op).12 G .318(recede the `#' with a `\\'.)-2.318
F .318(The f)4.318 F .318(act that the `#' character is the)-.08 F .047
(old \(pre-)72 688 R/F4 6/Times-Roman@0 SF(CR)A(T)-.36 E F2 2.047(\)s)C
046(tandard erase character means that it seldom appears in a \214le n\
ame, and allo)-2.047 F .046(ws this con)-.2 F -.12(ve)-.32 G .046
(ntion to be used for).12 F .196(scratch \214les.)72 698 R .197
(If you are using a)4.197 F F4(CR)2.197 E(T)-.36 E F2 2.197(,y)C .197(o\
ur erase character should be a ^H, as we demonstrated in section 1.1 ho)
-2.197 F 2.197(wt)-.2 G .197(his could)-2.197 F(be set up.)72 708 Q EP
%%Page: 5 5
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-5)276.17 E/F1 10
/Times-Bold@0 SF 2.5(1.4. Metacharacters)72 84 R(in the shell)2.5 E F0
09(The shell has a lar)97 99.6 R .09
(ge number of special characters \(lik)-.18 F 2.59(e`)-.1 G .09
(>'\) which indicate special functions.)-2.59 F 1.69 -.8(We s)5.09 H(ay)
8 E .792(that these notations ha)72 111.6 R -.15(ve)-.2 G/F2 10
/Times-Italic@0 SF(syntactic)3.441 E F0(and)4.957 E F2(semantic)3.291 E
F0 .791(meaning to the shell.)4.957 F .791
(In general, most characters which)5.791 F .24
(are neither letters nor digits ha)72 123.6 R .54 -.15(ve s)-.2 H .24
(pecial meaning to the shell.).15 F 1.84 -.8(We s)5.24 H .241
(hall shortly learn a means of).8 F F2(quotation)2.741 E F0(which allo)
72 135.6 Q(ws us to use)-.25 E F2(metac)2.5 E(har)-.15 E(acter)-.15 E(s)
-.1 E F0(without the shell treating them in an)4.166 E 2.5(ys)-.15 G
(pecial w)-2.5 E(ay)-.1 E(.)-.65 E 1.11(Metacharacters normally ha)97
151.2 R 1.41 -.15(ve e)-.2 H -.25(ff).15 G 1.11
(ect only when the shell is reading our input.).25 F 2.71 -.8(We n)6.11
H 1.11(eed not w).8 F(orry)-.1 E .126
(about placing shell metacharacters in a letter we are sending via)72
163.2 R F2(mail,)2.626 E F0 .126(or when we are typing in te)4.292 F
127(xt or data)-.15 F .298(to some other program.)72 175.2 R .297(Note\
that the shell is only reading input when it has prompted with `% ' \(\
although)5.298 F(we can type our input e)72 187.2 Q -.15(ve)-.25 G 2.5
(nb).15 G(efore it prompts\).)-2.5 E F1 2.5(1.5. Input)72 211.2 R(fr)2.5
E(om \214les; pipelines)-.18 E F0 2.114 -.8(We l)97 226.8 T .514
(earned abo).8 F .814 -.15(ve h)-.15 H 1.014 -.25(ow t).15 H(o).25 E F2
-.37(re)3.014 G(dir).37 E(ect)-.37 E F0(the)4.68 E F2(standar)3.014 E
3.015(do)-.37 G(utput)-3.015 E F0 .515(of a command to a \214le.)4.681 F
515(It is also possible to)5.515 F .911(redirect the)72 238.8 R F2
(standar)3.411 E 3.411(di)-.37 G(nput)-3.411 E F0 .91
(of a command from a \214le.)5.077 F .91
(This is not often necessary since most commands)5.91 F
(will read from a \214le whose name is gi)72 250.8 Q -.15(ve)-.25 G 2.5
(na).15 G 2.5(sa)-2.5 G 2.5(na)-2.5 G -.18(rg)-2.5 G 2.5(ument. W).18 F
2.5(ec)-.8 G(an gi)-2.5 E .3 -.15(ve t)-.25 H(he command).15 E
(sort < data)108 268.8 Q .854(to run the)72 286.8 R F2(sort)3.355 E F0
855(command with standard input, where the command normally reads its \
input, from the \214le)5.021 F 2.5(`data'. W)72 298.8 R 2.5(ew)-.8 G
(ould more lik)-2.6 E(ely say)-.1 E(sort data)108 316.8 Q(letting the)72
334.8 Q F2(sort)2.5 E F0(command open the \214le `data' for input itsel\
f since this is less to type.)4.166 E 1.6 -.8(We s)97 350.4 T
(hould note that if we just typed).8 E(sort)108 368.4 Q 1.498
(then the sort program w)72 386.4 R 1.498(ould sort lines from its)-.1 F
F2(standar)3.998 E 3.997(di)-.37 G(nput.)-3.997 E F0 1.497
(Since we did not)5.663 F F2 -.37(re)3.997 G(dir).37 E(ect)-.37 E F0
1.497(the standard)5.663 F(input, it w)72 398.4 Q(ould sort lines as we\
typed them on the terminal until we typed a ^D to indicate an end-of-\
\214le.)-.1 E 2.733(Am)97 414 S .234(ost useful capability is the abili\
ty to combine the standard output of one command with the stan-)-2.733 F
671(dard input of another)72 426 R 3.171(,i)-.4 G .671
(.e. to run the commands in a sequence kno)-3.171 F .671(wn as a)-.25 F
F2(pipeline)3.17 E(.)-.15 E F0 -.15(Fo)4.836 G 3.17(ri).15 G .67
(nstance the com-)-3.17 F(mand)72 438 Q(ls \255s)108 456 Q .139(normall\
y produces a list of the \214les in our directory with the size of each\
in blocks of 512 characters.)72 474 R .14(If we)5.139 F .137
(are interested in learning which of our \214les is lar)72 486 R .137
(gest we may wish to ha)-.18 F .437 -.15(ve t)-.2 H .137
(his sorted by size rather than by).15 F .612(name, which is the def)72
498 R .612(ault w)-.1 F .612(ay in which)-.1 F F2(ls)3.112 E F0 3.113
(sorts. W)4.779 F 3.113(ec)-.8 G .613(ould look at the man)-3.113 F
3.113(yo)-.15 G .613(ptions of)-3.113 F F2(ls)3.113 E F0 .613
(to see if there)4.779 F -.1(wa)72 510 S 2.505(sa).1 G 2.505(no)-2.505 G
005(ption to do this b)-2.505 F .005(ut w)-.2 F .005(ould e)-.1 F -.15
(ve)-.25 G .005(ntually disco).15 F -.15(ve)-.15 G 2.505(rt).15 G .005
(hat there is not.)-2.505 F .004(Instead we can use a couple of sim-)
5.005 F(ple options of the)72 522 Q F2(sort)2.5 E F0
(command, combining it with)4.166 E F2(ls)2.5 E F0(to get what we w)
4.166 E(ant.)-.1 E(The)97 537.6 Q F2<ad6e>2.5 E F0(option of sort speci\
\214es a numeric sort rather than an alphabetic sort.)4.166 E(Thus)5 E
(ls \255s | sort \255n)108 555.6 Q .237
(speci\214es that the output of the)72 573.6 R F2(ls)2.737 E F0 .237
(command run with the option)4.403 F F2<ad73>2.737 E F0 .238(is to be)
4.404 F F2(piped)2.738 E F0 .238(to the command)4.404 F F2(sort)2.738 E
F0(run)4.404 E .089(with the numeric sort option.)72 585.6 R .089
(This w)5.089 F .089(ould gi)-.1 F .389 -.15(ve u)-.25 H 2.589(sas).15 G
089(orted list of our \214les by size, b)-2.589 F .089
(ut with the smallest \214rst.)-.2 F 2.83 -.8(We c)72 597.6 T 1.23
(ould then use the).8 F F2<ad72>3.73 E F0(re)5.396 E -.15(ve)-.25 G 1.23
(rse sort option and the).15 F F2(head)3.731 E F0 1.231
(command in combination with the pre)5.397 F(vious)-.25 E(command doing)
72 609.6 Q(ls \255s | sort \255n \255r | head \2555)108 627.6 Q .048
(Here we ha)72 645.6 R .348 -.15(ve t)-.2 H(ak).15 E .048
(en a list of our \214les sorted alphabetically)-.1 F 2.548(,e)-.65 G
047(ach with the size in blocks.)-2.548 F 1.647 -.8(We h)5.047 H -2.25
-.2(av e).8 H .047(run this to)2.747 F .857(the standard input of the)72
657.6 R F2(sort)3.357 E F0 .857
(command asking it to sort numerically in re)5.023 F -.15(ve)-.25 G .858
(rse order \(lar).15 F .858(gest \214rst\).)-.18 F(This)5.858 E .737
(output has then been run into the command)72 669.6 R F2(head)3.236 E F0
736(which gi)4.902 F -.15(ve)-.25 G 3.236(su).15 G 3.236(st)-3.236 G
736(he \214rst fe)-3.236 F 3.236(wl)-.25 G 3.236(ines. In)-3.236 F .736
(this case we ha)3.236 F -.15(ve)-.2 G(ask)72 681.6 Q(ed)-.1 E F2(head)
2.5 E F0(for the \214rst 5 lines.)4.166 E(Thus this command gi)5 E -.15
(ve)-.25 G 2.5(su).15 G 2.5(st)-2.5 G(he names and sizes of our 5 lar)
-2.5 E(gest \214les.)-.18 E .136(The notation introduced abo)97 697.2 R
436 -.15(ve i)-.15 H 2.636(sc).15 G .136(alled the)-2.636 F F2(pipe)
2.636 E F0 2.636(mechanism. Commands)4.302 F .137(separated by `)2.637 F
-3.195 1.666(|' c)1.666 H(haracters)-1.666 E .014(are connected togethe\
r by the shell and the standard output of each is run into the standard\
input of the ne)72 709.2 R(xt.)-.15 E 2.251
(The leftmost command in a pipeline will normally tak)72 721.2 R 4.751
(ei)-.1 G 2.252(ts standard input from the terminal and the)-4.751 F EP
%%Page: 6 6
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 273.67(USD:4-6 An)72 52 R
(Introduction to the C shell)2.5 E 1.134
(rightmost will place its standard output on the terminal.)72 84 R 1.134
(Other e)6.134 F 1.133(xamples of pipelines will be gi)-.15 F -.15(ve)
-.25 G 3.633(nl).15 G(ater)-3.633 E .175(when we discuss the history me\
chanism; one important use of pipes which is illustrated there is in th\
e rout-)72 96 R(ing of information to the line printer)72 108 Q(.)-.55 E
/F1 10/Times-Bold@0 SF 2.5(1.6. Filenames)72 132 R F0(Man)97 147.6 Q
2.883(yc)-.15 G .383(ommands to be e)-2.883 F -.15(xe)-.15 G .383
(cuted will need the names of \214les as ar).15 F(guments.)-.18 E/F2 8
/Times-Roman@0 SF(UNIX)5.382 E/F3 10/Times-Italic@0 SF(pathnames)2.882 E
F0(consist)4.548 E .671(of a number of)72 159.6 R F3(components)3.171 E
F0 .671(separated by `/'.)4.837 F .671(Each component e)5.671 F .672
(xcept the last names a directory in which)-.15 F .198(the ne)72 171.6 R
198(xt component resides, in ef)-.15 F .198(fect specifying the)-.25 F
F3(path)2.698 E F0 .197(of directories to follo)4.363 F 2.697(wt)-.25 G
2.697(or)-2.697 G .197(each the \214le.)-2.697 F .197(Thus the)5.197 F
(pathname)72 183.6 Q(/etc/motd)108 201.6 Q .471(speci\214es a \214le in\
the directory `etc' which is a subdirectory of the)72 219.6 R F3 -.45
(ro)2.971 G(ot).45 E F0 .471(directory `/'.)4.637 F -.4(Wi)5.471 G .471
(thin this directory).4 F .027
(the \214le named is `motd' which stands for `message of the day'.)72
231.6 R(A)5.027 E F3(pathname)2.527 E F0 .026(that be)4.193 F .026
(gins with a slash is said)-.15 F .796(to be an)72 243.6 R F3(absolute)
3.297 E F0 .797(pathname since it is speci\214ed from the absolute top \
of the entire directory hierarch)4.963 F 3.297(yo)-.05 G(f)-3.297 E
1.397(the system \(the)72 255.6 R F3 -.45(ro)3.897 G(ot).45 E F0(\).)
1.666 E F3 -.8(Pa)6.397 G(thnames).8 E F0 1.396(which do not be)5.563 F
1.396(gin with `/' are interpreted as starting in the current)-.15 F F3
836(working dir)72 267.6 R(ectory)-.37 E F0 3.336(,w)1.666 G .836
(hich is, by def)-3.336 F .836(ault, your)-.1 F F3(home)3.336 E F0 .837
(directory and can be changed dynamically by the)5.002 F F3(cd)3.337 E
F0 .239(change directory command.)72 279.6 R .239
(Such pathnames are said to be)5.239 F F3 -.37(re)2.739 G(lative).37 E
F0 .239(to the w)4.405 F .239(orking directory since the)-.1 F 2.739(ya)
-.15 G(re)-2.739 E .038(found by starting in the w)72 291.6 R .038
(orking directory and descending to lo)-.1 F .039(wer le)-.25 F -.15(ve)
-.25 G .039(ls of directories for each).15 F F3(component)2.539 E F0 .48
(of the pathname.)72 303.6 R .479(If the pathname contains no slashes a\
t all then the \214le is contained in the w)5.48 F .479(orking direc-)
-.1 F .756(tory itself and the pathname is merely the name of the \214l\
e in this directory)72 315.6 R 5.756(.A)-.65 G .756
(bsolute pathnames ha)-5.756 F 1.057 -.15(ve n)-.2 H(o).15 E
(relation to the w)72 327.6 Q(orking directory)-.1 E(.)-.65 E .1
(Most \214lenames consist of a number of alphanumeric characters and `.)
97 343.2 R 1.199 -.55('s \()-.7 H 2.599(periods\). In).55 F -.1(fa)2.599
G .099(ct, all printing).1 F .501(characters e)72 355.2 R .501
(xcept `/' \(slash\) may appear in \214lenames.)-.15 F .501(It is incon)
5.501 F -.15(ve)-.4 G .502(nient to ha).15 F .802 -.15(ve m)-.2 H .502
(ost non-alphabetic char).15 F(-)-.2 E .783
(acters in \214lenames because man)72 367.2 R 3.283(yo)-.15 G 3.283(ft)
-3.283 G .783(hese ha)-3.283 F 1.083 -.15(ve s)-.2 H .783
(pecial meaning to the shell.).15 F .783(The character `.)5.783 F 3.283
('\()-.7 G .782(period\) is)-3.283 F 1.042
(not a shell-metacharacter and is often used to separate the)72 379.2 R
F3 -.2(ex)3.542 G(tension).2 E F0 1.043
(of a \214le name from the base of the)5.208 F 2.5(name. Thus)72 391.2 R
(prog.c prog.o prog.errs prog.output)108 409.2 Q .385
(are four related \214les.)72 427.2 R(The)5.385 E 2.885(ys)-.15 G .385
(hare a)-2.885 F F3(base)2.885 E F0 .385
(portion of a name \(a base portion being that part of the name that)
4.551 F .093(is left when a trailing `.)72 439.2 R 2.593('a)-.7 G .094
(nd follo)-2.593 F .094(wing characters which are not `.)-.25 F 2.594
('a)-.7 G .094(re stripped of)-2.594 F 2.594(f\). The)-.25 F .094
(\214le `prog.c' might)2.594 F .579(be the source for a C program, the \
\214le `prog.o' the corresponding object \214le, the \214le `prog.errs'\
the errors)72 451.2 R(resulting from a compilation of the program and \
the \214le `prog.output' the output of a run of the program.)72 463.2 Q
(If we wished to refer to all four of these \214les in a command, we co\
uld use the notation)97 478.8 Q(prog.*)108 496.8 Q .134(This e)72 514.8
R .134(xpression is e)-.15 F .135
(xpanded by the shell, before the command to which it is an ar)-.15 F
135(gument is e)-.18 F -.15(xe)-.15 G .135(cuted, into a).15 F .42
(list of names which be)72 526.8 R .42(gin with `prog.)-.15 F 2.919
('. The)-.7 F .419(character `*' here matches an)2.919 F 2.919(ys)-.15 G
419(equence \(including the empty)-2.919 F .337
(sequence\) of characters in a \214le name.)72 538.8 R .337
(The names which match are alphabetically sorted and placed in the)5.337
F F3(ar)72 550.8 Q(gument list)-.37 E F0(of the command.)4.166 E
(Thus the command)5 E(echo prog.*)108 568.8 Q(will echo the names)72
586.8 Q(prog.c prog.errs prog.o prog.output)108 604.8 Q .938
(Note that the names are in sorted order here, and a dif)72 622.8 R .937
(ferent order than we listed them abo)-.25 F -.15(ve)-.15 G 5.937(.T).15
G(he)-5.937 E F3(ec)3.437 E(ho)-.15 E F0 .464(command recei)72 634.8 R
-.15(ve)-.25 G 2.964(sf).15 G .464(our w)-2.964 F .464(ords as ar)-.1 F
464(guments, e)-.18 F -.15(ve)-.25 G 2.964(nt).15 G .464
(hough we only typed one w)-2.964 F .465(ord as as ar)-.1 F .465
(gument directly)-.18 F(.)-.65 E(The four w)72 646.8 Q
(ords were generated by)-.1 E F3(\214lename e)2.5 E(xpansion)-.2 E F0
(of the one input w)4.166 E(ord.)-.1 E .104(Other notations for)97 662.4
R F3 .104(\214lename e)2.604 F(xpansion)-.2 E F0 .104(are also a)4.27 F
-.25(va)-.2 G 2.604(ilable. The).25 F .104(character `?' matches an)
2.604 F 2.603(ys)-.15 G .103(ingle char)-2.603 F(-)-.2 E
(acter in a \214lename.)72 674.4 Q(Thus)5 E(echo ?)108 692.4 Q 1.666
(?? ???)4.166 F .994(will echo a line of \214lenames; \214rst those wit\
h one character names, then those with tw)72 710.4 R 3.495(oc)-.1 G .995
(haracter names,)-3.495 F
(and \214nally those with three character names.)72 722.4 Q
(The names of each length will be independently sorted.)5 E EP
%%Page: 7 7
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-7)276.17 E 1.509(Another \
mechanism consists of a sequence of characters between `[' and `]'.)97
84 R 1.509(This metasequence)6.509 F(matches an)72 96 Q 2.5(ys)-.15 G
(ingle character from the enclosed set.)-2.5 E(Thus)5 E(prog.[co])108
114 Q(will match)72 132 Q(prog.c prog.o)108 150 Q 1.025(in the e)72 168
R 1.025(xample abo)-.15 F -.15(ve)-.15 G 6.025(.W).15 G 3.525(ec)-6.825
G 1.025(an also place tw)-3.525 F 3.525(oc)-.1 G 1.025
(haracters around a `\255' in this notation to denote a range.)-3.525 F
(Thus)72 180 Q(chap.[1\2555])108 198 Q(might match \214les)72 216 Q
(chap.1 chap.2 chap.3 chap.4 chap.5)108 234 Q(if the)72 252 Q 2.5(ye)
-.15 G 2.5(xisted. This)-2.65 F(is shorthand for)2.5 E(chap.[12345])108
270 Q(and otherwise equi)72 288 Q -.25(va)-.25 G(lent.).25 E .565
(An important point to note is that if a list of ar)97 303.6 R .565
(gument w)-.18 F .565(ords to a command \(an)-.1 F/F1 10/Times-Italic@0
SF(ar)3.065 E .565(gument list\))-.37 F F0(con-)4.73 E 1.885
(tains \214lename e)72 315.6 R 1.885
(xpansion syntax, and if this \214lename e)-.15 F 1.885
(xpansion syntax f)-.15 F 1.886(ails to match an)-.1 F 4.386(ye)-.15 G
1.886(xisting \214le)-4.536 F(names, then the shell considers this to b\
e an error and prints a diagnostic)72 327.6 Q(No match.)108 345.6 Q
(and does not e)72 363.6 Q -.15(xe)-.15 G(cute the command.).15 E .476
(Another v)97 379.2 R .476
(ery important point is that \214les with the character `.)-.15 F 2.975
('a)-.7 G 2.975(tt)-2.975 G .475(he be)-2.975 F .475
(ginning are treated specially)-.15 F(.)-.65 E .076
(Neither `*' or `?' or the `[' `]' mechanism will match it.)72 391.2 R
077(This pre)5.077 F -.15(ve)-.25 G .077
(nts accidental matching of the \214lenames).15 F(`.)72 403.2 Q 2.655
('a)-.7 G .155(nd `..)-2.655 F 5.155('i)-.7 G 2.655(nt)-5.155 G .155
(he w)-2.655 F .155(orking directory which ha)-.1 F .455 -.15(ve s)-.2 H
154(pecial meaning to the system, as well as other \214les such as).15
F F1(.cshr)72 415.2 Q(c)-.37 E F0(which are not normally visible.)4.166
E 1.6 -.8(We w)5 H(ill discuss the special role of the \214le).8 E F1
(.cshr)2.5 E(c)-.37 E F0(later)4.166 E(.)-.55 E .346
(Another \214lename e)97 430.8 R .346(xpansion mechanism gi)-.15 F -.15
(ve)-.25 G 2.847(sa).15 G .347(ccess to the pathname of the)-2.847 F F1
(home)2.847 E F0 .347(directory of other)4.513 F 2.516(users. This)72
442.8 R .016(notation consists of the character `~' \(tilde\) follo)
2.516 F .015(wed by another user')-.25 F 2.515(sl)-.55 G .015
(ogin name.)-2.515 F -.15(Fo)5.015 G 2.515(ri).15 G(nstance)-2.515 E
203(the w)72 454.8 R .203(ord `~bill' w)-.1 F .204(ould map to the pat\
hname `/usr/bill' if the home directory for `bill' w)-.1 F .204
(as `/usr/bill'.)-.1 F(Since,)5.204 E .598(on lar)72 466.8 R .598
(ge systems, users may ha)-.18 F .897 -.15(ve l)-.2 H .597
(ogin directories scattered o).15 F -.15(ve)-.15 G 3.097(rm).15 G(an)
-3.097 E 3.097(yd)-.15 G(if)-3.097 E .597(ferent disk v)-.25 F .597
(olumes with dif)-.2 F(fer)-.25 E(-)-.2 E
(ent pre\214x directory names, this notation pro)72 478.8 Q(vides a con)
-.15 E -.15(ve)-.4 G(nient w).15 E
(ay of accessing the \214les of other users.)-.1 E 2.668(As)97 494.4 S
169
(pecial case of this notation consists of a `~' alone, e.g. `~/mbox'.)
-2.668 F .169(This notation is e)5.169 F .169(xpanded by the)-.15 F
1.333(shell into the \214le `mbox' in your)72 506.4 R F1(home)3.833 E F0
(directory)5.499 E 3.833(,i)-.65 G 1.332
(.e. into `/usr/bill/mbox' for me on Ernie Co-v)-3.833 F 1.332(ax, the)
-.25 F .64(UCB Computer Science Department V)72 518.4 R .641
(AX machine, where this document w)-1.35 F .641(as prepared.)-.1 F .641
(This can be v)5.641 F(ery)-.15 E .296(useful if you ha)72 530.4 R .596
-.15(ve u)-.2 H(sed).15 E F1(cd)2.796 E F0 .296
(to change to another directory and ha)4.462 F .596 -.15(ve f)-.2 H .295
(ound a \214le you wish to cop).15 F 2.795(yu)-.1 G(sing)-2.795 E F1
(cp.)2.795 E F0(If I gi)72 542.4 Q .3 -.15(ve t)-.25 H(he command).15 E
(cp that\214le ~)108 560.4 Q(the shell will e)72 578.4 Q
(xpand this command to)-.15 E(cp that\214le /usr/bill)108 596.4 Q
(since my home directory is /usr/bill.)72 614.4 Q .388(There also e)97
630 R .389(xists a mechanism using the characters `{' and `}' for abbre)
-.15 F .389(viating a set of w)-.25 F .389(ords which)-.1 F(ha)72 642 Q
824 -.15(ve c)-.2 H .524(ommon parts b).15 F .524(ut cannot be abbre)
-.2 F .524(viated by the abo)-.25 F .823 -.15(ve m)-.15 H .523
(echanisms because the).15 F 3.023(ya)-.15 G .523
(re not \214les, are the)-3.023 F 2.272
(names of \214les which do not yet e)72 654 R 2.272
(xist, are not thus con)-.15 F -.15(ve)-.4 G 2.272(niently described.)
15 F 2.272(This mechanism will be)7.272 F(described much later)72 666 Q
2.5(,i)-.4 G 2.5(ns)-2.5 G(ection 4.2, as it is used less frequently)
-2.5 E(.)-.65 E/F2 10/Times-Bold@0 SF 2.5(1.7. Quotation)72 690 R F0
2.69 -.8(We h)97 705.6 T -2.25 -.2(av e).8 H 1.089
(already seen a number of metacharacters used by the shell.)3.79 F 1.089
(These metacharacters pose a)6.089 F
(problem in that we cannot use them directly as parts of w)72 717.6 Q
2.5(ords. Thus)-.1 F(the command)2.5 E EP
%%Page: 8 8
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 273.67(USD:4-8 An)72 52 R
(Introduction to the C shell)2.5 E(echo *)108 90 Q .582
(will not echo the character `*'.)72 108 R .582
(It will either echo an sorted list of \214lenames in the current)5.582
F/F1 10/Times-Italic@0 SF .583(working dir)3.083 F(ec-)-.37 E(tory)72
120 Q(,)-.55 E F0
(or print the message `No match' if there are no \214les in the w)4.166
E(orking directory)-.1 E(.)-.65 E .393(The recommended mechanism for pl\
acing characters which are neither numbers, digits, `/', `.)97 135.6 R
2.892('o)-.7 G 2.892(r`)-2.892 G<ad27>-2.892 E(in an ar)72 147.6 Q
(gument w)-.18 E(ord to a command is to enclose it with single quotatio\
n characters `\264', i.e.)-.1 E(echo \264*\264)108 165.6 Q .242
(There is one special character `!' which is used by the)72 183.6 R F1
(history)2.742 E F0 .242(mechanism of the shell and which cannot be)
4.408 F F1(escaped)72 195.6 Q F0 .385
(by placing it within `\264' characters.)4.551 F .384
(It and the character `\264' itself can be preceded by a single `\\' to)
5.384 F(pre)72 207.6 Q -.15(ve)-.25 G(nt their special meaning.).15 E
(Thus)5 E(echo \\\264\\!)108 225.6 Q(prints)72 243.6 Q<b421>108 261.6 Q
621(These tw)72 279.6 R 3.121(om)-.1 G .621(echanisms suf)-3.121 F .621
(\214ce to place an)-.25 F 3.122(yp)-.15 G .622
(rinting character into a w)-3.122 F .622(ord which is an ar)-.1 F .622
(gument to a shell)-.18 F 2.5(command. The)72 291.6 R 2.5(yc)-.15 G
(an be combined, as in)-2.5 E(echo \\\264\264*\264)108 309.6 Q
(which prints)72 327.6 Q<b42a>108 345.6 Q
(since the \214rst `\\' escaped the \214rst `\264' and the `*' w)72
363.6 Q(as enclosed between `\264' characters.)-.1 E/F2 10/Times-Bold@0
SF 2.5(1.8. T)72 387.6 R(erminating commands)-.92 E F0 .228
(When you are e)97 403.2 R -.15(xe)-.15 G .228
(cuting a command and the shell is w).15 F .228
(aiting for it to complete there are se)-.1 F -.15(ve)-.25 G .227(ral w)
15 F(ays)-.1 E(to force it to stop.)72 415.2 Q -.15(Fo)5 G 2.5(ri).15 G
(nstance if you type the command)-2.5 E(cat /etc/passwd)108 433.2 Q .479
(the system will print a cop)72 451.2 R 2.979(yo)-.1 G 2.979(fal)-2.979
G .48(ist of all users of the system on your terminal.)-2.979 F .48
(This is lik)5.48 F .48(ely to continue)-.1 F .671(for se)72 463.2 R
-.15(ve)-.25 G .671(ral minutes unless you stop it.).15 F -1.1(Yo)5.671
G 3.171(uc)1.1 G .67(an send an)-3.171 F/F3 8/Times-Roman@0 SF(INTERR)
3.17 E(UPT)-.32 E F1(signal)3.17 E F0 .67(to the)4.836 F F1(cat)3.17 E
F0 .67(command by typing)4.836 F .396(^C on your terminal.*)72 475.2 R
(Since)5.397 E F1(cat)2.897 E F0 .397(does not tak)4.563 F 2.897(ea)-.1
G .697 -.15(ny p)-2.897 H .397(recautions to a).15 F -.2(vo)-.2 G .397
(id or otherwise handle this signal the).2 F F3(INTERR)72 487.2 Q(UPT)
-.32 E F0 .152(will cause it to terminate.)2.652 F .151
(The shell notices that)5.152 F F1(cat)2.651 E F0 .151
(has terminated and prompts you ag)4.317 F .151(ain with)-.05 F .832
(`% '.)72 499.2 R .832(If you hit)5.832 F F3(INTERR)3.333 E(UPT)-.32 E
F0(ag)3.333 E .833
(ain, the shell will just repeat its prompt since it handles)-.05 F F3
(INTERR)3.333 E(UPT)-.32 E F0(signals)3.333 E .721
(and chooses to continue to e)72 511.2 R -.15(xe)-.15 G .72
(cute commands rather than terminating lik).15 F(e)-.1 E F1(cat)3.22 E
F0 .72(did, which w)4.886 F .72(ould ha)-.1 F 1.02 -.15(ve t)-.2 H(he)
15 E(ef)72 523.2 Q(fect of logging you out.)-.25 E .628(Another w)97
538.8 R .628(ay in which man)-.1 F 3.128(yp)-.15 G .628
(rograms terminate is when the)-3.128 F 3.128(yg)-.15 G .628
(et an end-of-\214le from their standard)-3.128 F 2.75(input. Thus)72
550.8 R(the)2.75 E F1(mail)2.75 E F0 .25(program in the \214rst e)4.416
F .25(xample abo)-.15 F .55 -.15(ve w)-.15 H .249
(as terminated when we typed a ^D which gener).05 F(-)-.2 E .927
(ates an end-of-\214le from the standard input.)72 562.8 R .928
(The shell also terminates when it gets an end-of-\214le printing)5.927
F(`logout';)72 574.8 Q F3(UNIX)3.216 E F0 .715(then logs you of)3.216 F
3.215(ft)-.25 G .715(he system.)-3.215 F .715
(Since this means that typing too man)5.715 F 3.215(y^)-.15 G(D')-3.215
E 3.215(sc)-.55 G .715(an accidentally)-3.215 F .061(log us of)72 586.8
R .061(f, the shell has a mechanism for pre)-.25 F -.15(ve)-.25 G .061
(nting this.).15 F(This)5.061 E F1(ignor)2.561 E(eeof)-.37 E F0 .062
(option will be discussed in section)4.228 F(2.2.)72 598.8 Q 1.068(If a\
command has its standard input redirected from a \214le, then it will \
normally terminate when it)97 614.4 R(reaches the end of this \214le.)72
626.4 Q(Thus if we e)5 E -.15(xe)-.15 G(cute).15 E
(mail bill < prepared.te)108 644.4 Q(xt)-.15 E .502
(the mail command will terminate without our typing a ^D.)72 662.4 R
503(This is because it read to the end-of-\214le of our)5.503 F 1.083
(\214le `prepared.te)72 674.4 R 1.082
(xt' in which we placed a message for `bill' with an editor program.)
-.15 F 2.682 -.8(We c)6.082 H 1.082(ould also ha).8 F -.15(ve)-.2 G
(done)72 686.4 Q .32 LW 76 698 72 698 DL 80 698 76 698 DL 84 698 80 698
DL 88 698 84 698 DL 92 698 88 698 DL 96 698 92 698 DL 100 698 96 698 DL
104 698 100 698 DL 108 698 104 698 DL 112 698 108 698 DL 116 698 112 698
DL 120 698 116 698 DL 124 698 120 698 DL 128 698 124 698 DL 132 698 128
698 DL 136 698 132 698 DL 140 698 136 698 DL 144 698 140 698 DL F3
(*On some older Unix systems the)72 708 Q/F4 6/Times-Roman@0 SF(DEL)2 E
F3(or)2 E F4 -.24(RU)2 G(BOUT).24 E F3 -.08(ke)2 G 2(yh)-.04 G
(as the same ef)-2 E(fect. "stty all" will tell you the INTR k)-.2 E .24
-.12(ey v)-.08 H(alue.)-.08 E EP
%%Page: 9 9
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-9)276.17 E
(cat prepared.te)108 90 Q 1.666(xt | mail)-.15 F(bill)2.5 E .475
(since the)72 108 R/F1 10/Times-Italic@0 SF(cat)2.975 E F0 .475
(command w)4.641 F .475(ould then ha)-.1 F .775 -.15(ve w)-.2 H .475
(ritten the te).15 F .476
(xt through the pipe to the standard input of the mail)-.15 F 2.684
(command. When)72 120 R(the)2.684 E F1(cat)2.684 E F0 .184
(command completed it w)4.35 F .184(ould ha)-.1 F .484 -.15(ve t)-.2 H
183(erminated, closing do).15 F .183(wn the pipeline and the)-.25 F F1
(mail)72 132 Q F0 .254(command w)4.42 F .254(ould ha)-.1 F .554 -.15
(ve r)-.2 H(ecei).15 E -.15(ve)-.25 G 2.754(da).15 G 2.754(ne)-2.754 G
254(nd-of-\214le from it and terminated.)-2.754 F .255
(Using a pipe here is more com-)5.254 F 1.217
(plicated than redirecting input so we w)72 144 R 1.217(ould more lik)
-.1 F 1.217(ely use the \214rst form.)-.1 F 1.216
(These commands could also)6.217 F(ha)72 156 Q .3 -.15(ve b)-.2 H
(een stopped by sending an).15 E/F2 8/Times-Roman@0 SF(INTERR)2.5 E(UPT)
-.32 E F0(.)A .747
(Another possibility for stopping a command is to suspend its e)97 171.6
R -.15(xe)-.15 G .747(cution temporarily).15 F 3.247(,w)-.65 G .748
(ith the possi-)-3.247 F 1.272(bility of continuing e)72 183.6 R -.15
(xe)-.15 G 1.272(cution later).15 F 6.272(.T)-.55 G 1.272
(his is done by sending a)-6.272 F F2(ST)3.772 E(OP)-.144 E F0 1.272
(signal via typing a ^Z.)3.772 F 1.271(This signal)6.271 F .787
(causes all commands running on the terminal \(usually one b)72 195.6 R
788(ut more if a pipeline is e)-.2 F -.15(xe)-.15 G .788
(cuting\) to become).15 F 2.772(suspended. The)72 207.6 R .272
(shell notices that the command\(s\) ha)2.772 F .571 -.15(ve b)-.2 H
271(een suspended, types `Stopped' and then prompts).15 F .337
(for a ne)72 219.6 R 2.838(wc)-.25 G 2.838(ommand. The)-2.838 F(pre)
2.838 E .338(viously e)-.25 F -.15(xe)-.15 G .338
(cuting command has been suspended, b).15 F .338(ut otherwise unaf)-.2 F
338(fected by)-.25 F(the)72 231.6 Q F2(ST)3.654 E(OP)-.144 E F0 3.654
(signal. An)3.654 F 3.654(yo)-.15 G 1.154(ther commands can be e)-3.654
F -.15(xe)-.15 G 1.154
(cuted while the original command remains suspended.).15 F .521
(The suspended command can be continued using the)72 243.6 R F1(fg)3.021
E F0 .521(command with no ar)4.687 F 3.021(guments. The)-.18 F .521
(shell will then)3.021 F .285(retype the command to remind you which co\
mmand is being continued, and cause the command to resume)72 255.6 R
-.15(exe)72 267.6 S 3.286(cution. Unless).15 F(an)3.286 E 3.286(yi)-.15
G .786(nput \214les in use by the suspended command ha)-3.286 F 1.086
-.15(ve b)-.2 H .787(een changed in the meantime,).15 F .336
(the suspension has no ef)72 279.6 R .336(fect whatsoe)-.25 F -.15(ve)
-.25 G 2.835(ro).15 G 2.835(nt)-2.835 G .335(he e)-2.835 F -.15(xe)-.15
G .335(cution of the command.).15 F .335(This feature can be v)5.335 F
335(ery useful)-.15 F .589(during editing, when you need to look at an\
other \214le before continuing. An e)72 291.6 R .59
(xample of command suspen-)-.15 F(sion follo)72 303.6 Q(ws.)-.25 E 2.5
(%m)108 321.6 S(ail harold)-2.5 E
(Someone just copied a big \214le into my directory and its name is)108
333.6 Q(^Z)108 345.6 Q(Stopped)108 357.6 Q 2.5(%l)108 369.6 S(s)-2.5 E
(funn)108 381.6 Q(y\214le)-.15 E(prog.c)108 393.6 Q(prog.o)108 405.6 Q
2.5(%j)108 417.6 S(obs)-2.5 E 2.5([1] +)108 429.6 R 65.92(Stopped mail)
2.5 F(harold)2.5 E 2.5(%f)108 441.6 S(g)-2.5 E(mail harold)108 453.6 Q
(funn)108 465.6 Q(y\214le. Do you kno)-.15 E 2.5(ww)-.25 G(ho did it?)
-2.5 E(EO)108 477.6 Q(T)-.4 E(%)108 489.6 Q 1.058(In this e)72 507.6 R
1.058(xample someone w)-.15 F 1.058
(as sending a message to Harold and for)-.1 F 1.058
(got the name of the \214le he w)-.18 F 1.057(anted to)-.1 F 3.189
(mention. The)72 519.6 R .689(mail command w)3.189 F .689
(as suspended by typing ^Z.)-.1 F .69
(When the shell noticed that the mail program)5.689 F -.1(wa)72 531.6 S
2.91(ss).1 G .409(uspended, it typed `Stopped' and prompted for a ne)
-2.91 F 2.909(wc)-.25 G 2.909(ommand. Then)-2.909 F(the)2.909 E F1(ls)
2.909 E F0 .409(command w)4.575 F .409(as typed to)-.1 F .644
(\214nd out the name of the \214le.)72 543.6 R(The)5.644 E F1(jobs)3.144
E F0 .644(command w)4.81 F .644(as run to \214nd out which command w)-.1
F .644(as suspended. At)-.1 F .29(this time the)72 555.6 R F1(fg)2.79 E
F0 .29(command w)4.456 F .29(as typed to continue e)-.1 F -.15(xe)-.15 G
29(cution of the mail program.).15 F .289(Input to the mail program)
5.289 F -.1(wa)72 567.6 S 2.525(st).1 G .026(hen continued and ended wi\
th a ^D which indicated the end of the message at which time the mail p\
ro-)-2.525 F .667(gram typed EO)72 579.6 R 4.647 -.74(T. T)-.4 H(he).74
E F1(jobs)3.167 E F0 .667(command will sho)4.833 F 3.167(ww)-.25 G .666
(hich commands are suspended.)-3.167 F .666(The ^Z should only be)5.666
F .214(typed at the be)72 591.6 R .214(ginning of a line since e)-.15 F
-.15(ve)-.25 G .214
(rything typed on the current line is discarded when a signal is sent)
15 F .744(from the k)72 603.6 R -.15(ey)-.1 G 3.244(board. This).15 F
744(also happens on)3.244 F F2(INTERR)3.244 E(UPT)-.32 E F0 3.244(,a)C
(nd)-3.244 E F2 -.08(QU)3.244 G(IT).08 E F0 3.244(signals. More)3.244 F
744(information on suspending)3.244 F(jobs and controlling them is gi)
72 615.6 Q -.15(ve)-.25 G 2.5(ni).15 G 2.5(ns)-2.5 G(ection 2.6.)-2.5 E
1.144(If you write or run programs which are not fully deb)97 631.2 R
1.145(ugged then it may be necessary to stop them)-.2 F(some)72 643.2 Q
002(what ungracefully)-.25 F 5.002(.T)-.65 G .002
(his can be done by sending them a)-5.002 F F2 -.08(QU)2.501 G(IT).08 E
F0 .001(signal, sent by typing a ^\\.)2.501 F .001(This will usu-)5.001
F(ally pro)72 655.2 Q -.2(vo)-.15 G .2 -.1(ke t).2 H
(he shell to produce a message lik).1 E(e:)-.1 E(Quit \(Core dumped\))
108 673.2 Q .12(indicating that a \214le `core' has been created contai\
ning information about the running program')72 691.2 R 2.62(ss)-.55 G
12(tate when)-2.62 F 1.5(it terminated due to the)72 703.2 R F2 -.08
(QU)3.999 G(IT).08 E F0 3.999(signal. Y)3.999 F 1.499(ou can e)-1.1 F
1.499(xamine this \214le yourself, or forw)-.15 F 1.499
(ard information to the)-.1 F
(maintainer of the program telling him/her where the)72 715.2 Q F1(cor)
2.5 E 2.5<658c>-.37 G(le)-2.5 E F0(is.)4.166 E EP
%%Page: 10 10
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-10 An)72 52 R
(Introduction to the C shell)2.5 E 1.566
(If you run background commands \(as e)97 84 R 1.567
(xplained in section 2.6\) then these commands will ignore)-.15 F/F1 8
/Times-Roman@0 SF(INTERR)72 96 Q(UPT)-.32 E F0(and)2.677 E F1 -.08(QU)
2.677 G(IT).08 E F0 .176(signals at the terminal.)2.676 F 1.776 -.8
(To s)5.176 H .176(top them you must use the).8 F/F2 10/Times-Italic@0
SF(kill)2.676 E F0 2.676(command. See)4.342 F .176(section 2.6)2.676 F
(for an e)72 108 Q(xample.)-.15 E .35(If you w)97 123.6 R .35(ant to e)
-.1 F .35(xamine the output of a command without ha)-.15 F .351
(ving it mo)-.2 F .651 -.15(ve o)-.15 H .851 -.25(ff t).15 H .351
(he screen as the output).25 F(of the)72 135.6 Q(cat /etc/passwd)108
153.6 Q(command will, you can use the command)72 171.6 Q
(more /etc/passwd)108 189.6 Q(The)72 207.6 Q F2(mor)2.877 E(e)-.37 E F0
376(program pauses after each complete screenful and types `\255\255Mo\
re\255\255' at which point you can hit)4.543 F 2.608(as)72 219.6 S .108
(pace to get another screenful, a return to get another line, a `?' to \
get some help on other commands, or a)-2.608 F(`q' to end the)72 231.6 Q
F2(mor)2.5 E(e)-.37 E F0 2.5(program. Y)4.166 F
(ou can also use more as a \214lter)-1.1 E 2.5(,i)-.4 G(.e.)-2.5 E
(cat /etc/passwd | more)108 249.6 Q -.1(wo)72 267.6 S(rks just lik).1 E
2.5(et)-.1 G(he more simple more command abo)-2.5 E -.15(ve)-.15 G(.).15
E -.15(Fo)97 283.2 S 3.68(rs).15 G 1.179
(topping output of commands not in)-3.68 F -.2(vo)-.4 G(lving).2 E F2
(mor)3.679 E(e)-.37 E F0 1.179(you can use the ^S k)5.345 F 1.479 -.15
(ey t)-.1 H 3.679(os).15 G 1.179(top the typeout.)-3.679 F .346
(The typeout will resume when you hit ^Q or an)72 295.2 R 2.846(yo)-.15
G .346(ther k)-2.846 F -.15(ey)-.1 G 2.846(,b)-.5 G .346
(ut ^Q is normally used because it only restarts)-3.046 F .391
(the output and does not become input to the program which is running.)
72 307.2 R .391(This w)5.391 F .391(orks well on lo)-.1 F .391
(w-speed ter)-.25 F(-)-.2 E .666(minals, b)72 319.2 R .666
(ut at 9600 baud it is hard to type ^S and ^Q f)-.2 F .667
(ast enough to paginate the output nicely)-.1 F 3.167(,a)-.65 G .667
(nd a pro-)-3.167 F(gram lik)72 331.2 Q(e)-.1 E F2(mor)2.5 E(e)-.37 E F0
(is usually used.)4.166 E .316(An additional possibility is to use the \
^O \215ush output character; when this character is typed, all out-)97
346.8 R .837(put from the current command is thro)72 358.8 R .838(wn a)
-.25 F -.1(wa)-.15 G 3.338(y\().1 G .838(quickly\) until the ne)-3.338 F
838(xt input read occurs or until the ne)-.15 F(xt)-.15 E .492
(shell prompt.)72 370.8 R .492(This can be used to allo)5.492 F 2.992
(wac)-.25 G .492(ommand to complete without ha)-2.992 F .491
(ving to suf)-.2 F .491(fer through the out-)-.25 F .003(put on a slo)72
382.8 R 2.503(wt)-.25 G .004
(erminal; ^O is a toggle, so \215ushing can be turned of)-2.503 F 2.504
(fb)-.25 G 2.504(yt)-2.504 G .004(yping ^O ag)-2.504 F .004
(ain while output is being)-.05 F(\215ushed.)72 394.8 Q/F3 10
/Times-Bold@0 SF 2.5(1.9. What)72 418.8 R(no)2.5 E(w?)-.1 E F0 1.857 -.8
(We h)97 434.4 T -2.25 -.2(av e).8 H .257(so f)2.957 F .256(ar seen a n\
umber of mechanisms of the shell and learned a lot about the w)-.1 F
256(ay in which it)-.1 F 2.738(operates. The)72 446.4 R .238(remaining\
sections will go yet further into the internals of the shell, b)2.738 F
239(ut you will surely w)-.2 F(ant)-.1 E 1.006
(to try using the shell before you go an)72 458.4 R 3.506(yf)-.15 G
(urther)-3.506 E 6.006(.T)-.55 G 3.506(ot)-6.806 G 1.006
(ry it you can log in to)-3.506 F F1(UNIX)3.506 E F0 1.005
(and type the follo)3.505 F(wing)-.25 E(command to the system:)72 470.4
Q(chsh myname /bin/csh)108 488.4 Q .415(Here `myname' should be replace\
d by the name you typed to the system prompt of `login:' to get onto th\
e)72 506.4 R 3.82(system. Thus)72 518.4 R 3.82(Iw)3.82 G 1.32
(ould use `chsh bill /bin/csh'.)-3.92 F F3 -1.11(Yo)6.32 G 3.82(uo)1.11
G 1.32(nly ha)-3.82 F 1.52 -.1(ve t)-.25 H 3.82(od).1 G 3.82(ot)-3.82 G
1.32(his once; it tak)-3.82 F 1.32(es effect at next)-.1 F(login.)72
530.4 Q F0 -1.1(Yo)5 G 2.5(ua)1.1 G(re no)-2.5 E 2.5(wr)-.25 G
(eady to try using)-2.5 E F2(csh.)2.5 E F0 .144(Before you do the `chsh\
' command, the shell you are using when you log into the system is `/bi\
n/sh'.)97 546 R .555(In f)72 558 R .555(act, much of the abo)-.1 F .855
-.15(ve d)-.15 H .555(iscussion is applicable to `/bin/sh'.).15 F .555
(The ne)5.555 F .554(xt section will introduce man)-.15 F 3.054(yf)-.15
G(ea-)-3.054 E(tures particular to)72 570 Q F2(csh)2.5 E F0
(so you should change your shell to)4.166 E F2(csh)2.5 E F0
(before you be)4.166 E(gin reading it.)-.15 E EP
%%Page: 11 11
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-11)271.17 E/F1 10
/Times-Bold@0 SF 2.5(2. Details)72 84 R(on the shell f)2.5 E
(or terminal users)-.25 E 2.5(2.1. Shell)72 108 R
(startup and termination)2.5 E F0 1.305
(When you login, the shell is started by the system in your)97 123.6 R
/F2 10/Times-Italic@0 SF(home)3.806 E F0 1.306(directory and be)5.472 F
1.306(gins by reading)-.15 F .311(commands from a \214le)72 135.6 R F2
(.cshr)2.811 E(c)-.37 E F0 .31(in this directory)4.476 F 5.31(.A)-.65 G
31(ll shells which you may start during your terminal session)-5.31 F
537(will read from this \214le.)72 147.6 R 2.138 -.8(We w)5.538 H .538
(ill later see what kinds of commands are usefully placed there.).8 F
-.15(Fo)5.538 G 3.038(rn).15 G 1.038 -.25(ow w)-3.038 H(e).25 E
(need not ha)72 159.6 Q .3 -.15(ve t)-.2 H
(his \214le and the shell does not complain about its absence.).15 E(A)
97 175.2 Q F2(lo)2.7 E .2(gin shell)-.1 F F0 2.7(,e)1.666 G -.15(xe)
-2.85 G .199(cuted after you login to the system, will, after it reads \
commands from).15 F F2(.cshr)2.699 E(c,)-.37 E F0(read)4.365 E .392
(commands from a \214le)72 187.2 R F2(.lo)2.892 E(gin)-.1 E F0 .392
(also in your home directory)4.558 F 5.392(.T)-.65 G .392
(his \214le contains commands which you wish to)-5.392 F
(do each time you login to the)72 199.2 Q/F3 8/Times-Roman@0 SF(UNIX)2.5
E F0 2.5(system. My)2.5 F F2(.lo)2.5 E(gin)-.1 E F0
(\214le looks something lik)4.166 E(e:)-.1 E(set ignoreeof)108 217.2 Q
(set mail=\(/usr/spool/mail/bill\))108 229.2 Q
(echo "${prompt}users" ; users)108 241.2 Q(alias ts \\)108 253.2 Q
(\264set noglob ; e)133 265.2 Q -.25(va)-.25 G 2.5<6c92>.25 G(tset \255\
s \255m dialup:c100rv4pna \255m plugboard:?hp2621nl *\222\264;)-2.5 E
(ts; stty intr ^C kill ^U crt)108 277.2 Q(set time=15 history=10)108
289.2 Q(msgs \255f)108 301.2 Q(if \(\255e $mail\) then)108 313.2 Q
(echo "${prompt}mail")133 325.2 Q(mail)133 337.2 Q(endif)108 349.2 Q
073(This \214le contains se)97 370.8 R -.15(ve)-.25 G .072
(ral commands to be e).15 F -.15(xe)-.15 G .072(cuted by).15 F F3(UNIX)
2.572 E F0 .072(each time I login.)2.572 F .072(The \214rst is a)5.072 F
F2(set)2.572 E F0(com-)4.238 E .025
(mand which is interpreted directly by the shell.)72 382.8 R .025
(It sets the shell v)5.025 F(ariable)-.25 E F2(ignor)2.525 E(eeof)-.37 E
F0 .026(which causes the shell to)4.191 F .446(not log me of)72 394.8 R
2.946(fi)-.25 G 2.946(fIh)-2.946 G .446(it ^D.)-2.946 F(Rather)5.446 E
2.946(,Iu)-.4 G .446(se the)-2.946 F F2(lo)2.946 E(gout)-.1 E F0 .445
(command to log of)4.612 F 2.945(fo)-.25 G 2.945(ft)-2.945 G .445
(he system.)-2.945 F .445(By setting the)5.445 F F2(mail)2.945 E F0 -.25
(va)72 406.8 S .332(riable, I ask the shell to w).25 F .332
(atch for incoming mail to me.)-.1 F(Ev)5.332 E .333
(ery 5 minutes the shell looks for this \214le and)-.15 F
(tells me if more mail has arri)72 418.8 Q -.15(ve)-.25 G 2.5(dt).15 G
2.5(here. An)-2.5 F(alternati)2.5 E .3 -.15(ve t)-.25 H 2.5(ot).15 G
(his is to put the command)-2.5 E(bif)108 436.8 Q 2.5(fy)-.25 G .677
(in place of this)72 454.8 R F2(set;)3.177 E F0 .676
(this will cause me to be noti\214ed immediately when mail arri)4.842 F
-.15(ve)-.25 G .676(s, and to be sho).15 F .676(wn the)-.25 F
(\214rst fe)72 466.8 Q 2.5(wl)-.25 G(ines of the ne)-2.5 E 2.5(wm)-.25 G
(essage.)-2.5 E(Ne)97 482.4 Q .584(xt I set the shell v)-.15 F .584(ari\
able `time' to `15' causing the shell to automatically print out statis\
tics lines)-.25 F .065(for commands which e)72 494.4 R -.15(xe)-.15 G
065(cute for at least 15 seconds of).15 F F3(CPU)2.565 E F0 2.565
(time. The)2.565 F -.25(va)2.565 G .064
(riable `history' is set to 10 indicat-).25 F(ing that I w)72 506.4 Q
(ant the shell to remember the last 10 commands I type in its)-.1 E F2
(history list)2.5 E F0 2.5(,\()1.666 G(described later\).)-2.5 E 3.037
(Ic)97 522 S .537(reate an)-3.037 F F2(alias)3.037 E F0 -.74(``)4.703 G
(ts').74 E 3.037('w)-.74 G .537(hich e)-3.037 F -.15(xe)-.15 G .537
(cutes a).15 F F2(tset)3.037 E F0 .538
(\(1\) command setting up the modes of the terminal.)1.666 F(The)5.538 E
475(parameters to)72 534 R F2(tset)2.975 E F0 .474(indicate the kinds \
of terminal which I usually use when not on a hardwired port.)4.641 F
2.974(It)5.474 G(hen)-2.974 E -.15(exe)72 546 S .16(cute `).15 F(`ts')
-.74 E 2.66('a)-.74 G .16(nd also use the)-2.66 F F2(stty)2.661 E F0
161(command to change the interrupt character to ^C and the line kill \
charac-)4.327 F(ter to ^U.)72 558 Q 3.052(It)97 573.6 S .552
(hen run the `msgs' program, which pro)-3.052 F .552(vides me with an)
-.15 F 3.052(ys)-.15 G .552(ystem messages which I ha)-3.052 F .851 -.15
(ve n)-.2 H .551(ot seen).15 F .7(before; the `\255f)72 585.6 R 3.2('o)
55 G .7(ption here pre)-3.2 F -.15(ve)-.25 G .7
(nts it from telling me an).15 F .701(ything if there are no ne)-.15 F
3.201(wm)-.25 G 3.201(essages. Finally)-3.201 F 3.201(,i)-.65 G(f)-3.201
E(my mailbox \214le e)72 597.6 Q
(xists, then I run the `mail' program to process my mail.)-.15 E .246(W\
hen the `mail' and `msgs' programs \214nish, the shell will \214nish pr\
ocessing my)97 613.2 R F2(.lo)2.746 E(gin)-.1 E F0 .245(\214le and be)
4.412 F(gin)-.15 E .41
(reading commands from the terminal, prompting for each with `% '.)72
625.2 R .41(When I log of)5.41 F 2.911(f\()-.25 G .411(by gi)-2.911 F
411(ving the)-.25 F F2(lo)2.911 E(gout)-.1 E F0 .123
(command\) the shell will print `logout' and e)72 637.2 R -.15(xe)-.15 G
122(cute commands from the \214le `.logout' if it e).15 F .122
(xists in my home)-.15 F(directory)72 649.2 Q 5.035(.A)-.65 G .036
(fter that the shell will terminate and)-5.035 F F3(UNIX)2.536 E F0 .036
(will log me of)2.536 F 2.536(ft)-.25 G .036(he system.)-2.536 F .036
(If the system is not going)5.036 F(do)72 661.2 Q .267(wn, I will recei)
-.25 F .567 -.15(ve a n)-.25 H .767 -.25(ew l).15 H .267(ogin message.)
25 F .267(In an)5.267 F 2.767(yc)-.15 G .267
(ase, after the `logout' message the shell is committed to)-2.767 F
(terminating and will tak)72 673.2 Q 2.5(en)-.1 G 2.5(of)-2.5 G
(urther input from my terminal.)-2.5 E EP
%%Page: 12 12
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-12 An)72 52 R
(Introduction to the C shell)2.5 E/F1 10/Times-Bold@0 SF 2.5(2.2. Shell)
72 84 R -.1(va)2.5 G(riables).1 E F0 .519(The shell maintains a set of)
97 99.6 R/F2 10/Times-Italic@0 SF(variables.)3.019 E F0 2.119 -.8(We s)
4.685 H .819 -.15(aw a).8 H(bo).15 E .819 -.15(ve t)-.15 H .519(he v).15
F(ariables)-.25 E F2(history)3.019 E F0(and)4.685 E F2(time)3.019 E F0
519(which had v)4.685 F(al-)-.25 E .288(ues `10' and `15'.)72 111.6 R
287(In f)5.288 F .287(act, each shell v)-.1 F .287(ariable has as v)
-.25 F .287(alue an array of zero or more)-.25 F F2(strings.)2.787 E F0
287(Shell v)4.453 F(ariables)-.25 E 1.305(may be assigned v)72 123.6 R
1.305(alues by the set command.)-.25 F 1.305(It has se)6.305 F -.15(ve)
-.25 G 1.305(ral forms, the most useful of which w).15 F 1.305(as gi)-.1
F -.15(ve)-.25 G(n).15 E(abo)72 135.6 Q .3 -.15(ve a)-.15 H(nd is).15 E
(set name=v)108 153.6 Q(alue)-.25 E .266(Shell v)97 175.2 R .266
(ariables may be used to store v)-.25 F .265
(alues which are to be used in commands later through a substi-)-.25 F
082(tution mechanism.)72 187.2 R .082(The shell v)5.082 F .082
(ariables most commonly referenced are, ho)-.25 F(we)-.25 E -.15(ve)-.25
G .882 -.4(r, t).15 H .082(hose which the shell itself).4 F(refers to.)
72 199.2 Q(By changing the v)5 E(alues of these v)-.25 E
(ariables one can directly af)-.25 E(fect the beha)-.25 E
(vior of the shell.)-.2 E .437(One of the most important v)97 214.8 R
437(ariables is the v)-.25 F(ariable)-.25 E F2(path.)2.937 E F0 .437
(This v)4.603 F .437(ariable contains a sequence of direc-)-.25 F .346
(tory names where the shell searches for commands.)72 226.8 R(The)5.346
E F2(set)2.846 E F0 .346(command with no ar)4.512 F .346(guments sho)
-.18 F .346(ws the v)-.25 F(alue)-.25 E .169(of all v)72 238.8 R .169
(ariables currently de\214ned \(we usually say)-.25 F F2(set\))2.669 E
F0 .169(in the shell.)4.335 F .168(The def)5.169 F .168(ault v)-.1 F
168(alue for path will be sho)-.25 F(wn)-.25 E(by)72 250.8 Q F2(set)2.5
E F0(to be)4.166 E 2.5(%s)108 268.8 S(et)-2.5 E(ar)108 280.8 Q 33.91
(gv \(\))-.18 F 34.84(cwd /usr/bill)108 292.8 R 29.28(home /usr/bill)108
304.8 R 34.28(path \(.)108 316.8 R(/usr/ucb /bin /usr/bin\))2.5 E 22.61
(prompt %)108 328.8 R 32.61(shell /bin/csh)108 340.8 R 28.72(status 0)
108 352.8 R 33.17(term c100rv4pna)108 364.8 R 34.84(user bill)108 376.8
R(%)108 388.8 Q .422(This output indicates that the v)72 406.8 R .422
(ariable path points to the current directory `.)-.25 F 2.923('a)-.7 G
423(nd then `/usr/ucb', `/bin' and)-2.923 F 3.238(`/usr/bin'. Commands)
72 418.8 R .738(which you may write might be in `.)3.238 F 3.238('\()-.7
G .738(usually one of your directories\).)-3.238 F(Commands)5.738 E(de)
72 430.8 Q -.15(ve)-.25 G .526(loped at Berk).15 F(ele)-.1 E 1.826 -.65
(y, l)-.15 H -2.15 -.25(iv e).65 H .527(in `/usr/ucb' while commands de)
3.276 F -.15(ve)-.25 G .527(loped at Bell Laboratories li).15 F .827
-.15(ve i)-.25 H 3.027(n`).15 G .527(/bin' and)-3.027 F(`/usr/bin'.)72
442.8 Q 3.027(An)97 458.4 S .527(umber of locally de)-3.027 F -.15(ve)
-.25 G .526(loped programs on the system li).15 F .826 -.15(ve i)-.25 H
3.026(nt).15 G .526(he directory `/usr/local'.)-3.026 F .526(If we wish)
5.526 F(that all shells which we in)72 470.4 Q -.2(vo)-.4 G .2 -.1(ke t)
2 H 2.5(oh).1 G -2.25 -.2(av e)-2.5 H(access to these ne)2.7 E 2.5(wp)
-.25 G(rograms we can place the command)-2.5 E
(set path=\(. /usr/ucb /bin /usr/bin /usr/local\))108 488.4 Q
(in our \214le)72 506.4 Q F2(.cshr)2.5 E(c)-.37 E F0
(in our home directory)4.166 E 5(.T)-.65 G
(ry doing this and then logging out and back in and do)-5.35 E(set)108
524.4 Q(ag)72 542.4 Q(ain to see that the v)-.05 E(alue assigned to)-.25
E F2(path)2.5 E F0(has changed.)4.166 E .075(One thing you should be a)
97 558 R -.1(wa)-.15 G .075(re of is that the shell e).1 F .075
(xamines each directory which you insert into your)-.15 F .761
(path and determines which commands are contained there.)72 570 R .762
(Except for the current directory `.)5.761 F .762(', which the)-.7 F
1.001(shell treats specially)72 582 R 3.501(,t)-.65 G 1(his means that \
if commands are added to a directory in your search path after you)
-3.501 F(ha)72 594 Q .525 -.15(ve s)-.2 H .225(tarted the shell, the).15
F 2.725(yw)-.15 G .225(ill not necessarily be found by the shell.)-2.725
F .225(If you wish to use a command which)5.225 F
(has been added in this w)72 606 Q(ay)-.1 E 2.5(,y)-.65 G(ou should gi)
-2.5 E .3 -.15(ve t)-.25 H(he command).15 E(rehash)108 624 Q .212(to th\
e shell, which will cause it to recompute its internal table of command\
locations, so that it will \214nd the)72 642 R(ne)72 654 Q .229
(wly added command.)-.25 F .229
(Since the shell has to look in the current directory `.)5.229 F 2.73
('o)-.7 G 2.73(ne)-2.73 G .23(ach command, placing it)-2.73 F
(at the end of the path speci\214cation usually w)72 666 Q(orks equi)-.1
E -.25(va)-.25 G(lently and reduces o).25 E -.15(ve)-.15 G(rhead.).15 E
32 LW 76 686.2 72 686.2 DL 80 686.2 76 686.2 DL 84 686.2 80 686.2 DL 88
686.2 84 686.2 DL 92 686.2 88 686.2 DL 96 686.2 92 686.2 DL 100 686.2 96
686.2 DL 104 686.2 100 686.2 DL 108 686.2 104 686.2 DL 112 686.2 108
686.2 DL 116 686.2 112 686.2 DL 120 686.2 116 686.2 DL 124 686.2 120
686.2 DL 128 686.2 124 686.2 DL 132 686.2 128 686.2 DL 136 686.2 132
686.2 DL 140 686.2 136 686.2 DL 144 686.2 140 686.2 DL/F3 8
/Times-Roman@0 SF 4<8741>82 698 S .031
(nother directory that might interest you is /usr/ne)-4 F 1.071 -.52
(w, w)-.2 H .032(hich contains man).52 F 2.032(yu)-.12 G .032
(seful user)-2.032 F(-contrib)-.16 E .032(uted programs pro)-.16 F
(vided)-.12 E(with Berk)72 708 Q(ele)-.08 E 2(yU)-.12 G(nix.)-2 E EP
%%Page: 13 13
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-13)271.17 E .727
(Other useful b)97 84 R .727(uilt in v)-.2 F .727(ariables are the v)
-.25 F(ariable)-.25 E/F1 10/Times-Italic@0 SF(home)3.227 E F0 .726
(which sho)4.892 F .726(ws your home directory)-.25 F(,)-.65 E F1(cwd)
3.226 E F0(which)4.892 E .681(contains your current w)72 96 R .681
(orking directory)-.1 F 3.181(,t)-.65 G .681(he v)-3.181 F(ariable)-.25
E F1(ignor)3.182 E(eeof)-.37 E F0 .682(which can be set in your)4.848 F
F1(.lo)3.182 E(gin)-.1 E F0 .682(\214le to tell)4.848 F 1.479
(the shell not to e)72 108 R 1.479(xit when it recei)-.15 F -.15(ve)-.25
G 3.979(sa).15 G 3.979(ne)-3.979 G 1.479
(nd-of-\214le from a terminal \(as described abo)-3.979 F -.15(ve)-.15 G
3.978(\). The).15 F -.25(va)3.978 G(riable).25 E -1.95(`ignoreeof ')72
120 R .622(is one of se)3.122 F -.15(ve)-.25 G .623(ral v).15 F .623
(ariables which the shell does not care about the v)-.25 F .623
(alue of, only whether the)-.25 F(y)-.15 E(are)72 132 Q F1(set)2.5 E F0
(or)4.166 E F1(unset.)2.5 E F0(Thus to set this v)4.166 E
(ariable you simply do)-.25 E(set ignoreeof)108 150 Q
(and to unset it do)72 168 Q(unset ignoreeof)108 186 Q(These gi)72 204 Q
3 -.15(ve t)-.25 H(he v).15 E(ariable `ignoreeof)-.25 E 2.5('n).55 G
2.5(ov)-2.5 G(alue, b)-2.75 E(ut none is desired or required.)-.2 E
(Finally)97 219.6 Q 2.561(,s)-.65 G .061(ome other b)-2.561 F .061
(uilt-in shell v)-.2 F .061(ariables of use are the v)-.25 F(ariables)
-.25 E F1(noclobber)2.56 E F0(and)4.226 E F1(mail.)2.56 E F0 .06
(The metasyn-)4.226 F(tax)72 231.6 Q 2.5<3e8c>108 249.6 S(lename)-2.5 E
725(which redirects the standard output of a command will o)72 267.6 R
-.15(ve)-.15 G .726(rwrite and destro).15 F 3.226(yt)-.1 G .726(he pre)
-3.226 F .726(vious contents of the)-.25 F .682(named \214le.)72 279.6 R
682(In this w)5.682 F .682(ay you may accidentally o)-.1 F -.15(ve)-.15
G .682(rwrite a \214le which is v).15 F 3.181(aluable. If)-.25 F .681
(you w)3.181 F .681(ould prefer that)-.1 F(the shell not o)72 291.6 Q
-.15(ve)-.15 G(rwrite \214les in this w).15 E(ay you can)-.1 E
(set noclobber)108 309.6 Q(in your)72 327.6 Q F1(.lo)2.5 E(gin)-.1 E F0
2.5(\214le. Then)4.166 F(trying to do)2.5 E(date > no)108 345.6 Q(w)-.25
E -.1(wo)72 363.6 S(uld cause a diagnostic if `no).1 E(w' e)-.25 E
(xisted already)-.15 E 5(.Y)-.65 G(ou could type)-6.1 E(date >!)108
381.6 Q(no)5 E(w)-.25 E 1.054(if you really w)72 399.6 R 1.054
(anted to o)-.1 F -.15(ve)-.15 G 1.054(rwrite the contents of `no).15 F
3.554(w'. The)-.25 F 1.054(`>!' is a special metasyntax indicating that)
3.554 F(clobbering the \214le is ok.\207)72 411.6 Q/F2 10/Times-Bold@0
SF 2.5(2.3. The)72 435.6 R(shell')2.5 E 2.5(sh)-.37 G(istory list)-2.5 E
F0 .255(The shell can maintain a)97 451.2 R F1 .256(history list)2.756 F
F0 .256(into which it places the w)4.422 F .256(ords of pre)-.1 F .256
(vious commands.)-.25 F .256(It is pos-)5.256 F 1.538
(sible to use a notation to reuse commands or w)72 463.2 R 1.538
(ords from commands in forming ne)-.1 F 4.038(wc)-.25 G 4.038
(ommands. This)-4.038 F(mechanism can be used to repeat pre)72 475.2 Q
(vious commands or to correct minor typing mistak)-.25 E
(es in commands.)-.1 E .496(The follo)97 490.8 R .496(wing \214gure gi)
-.25 F -.15(ve)-.25 G 2.996(sas).15 G .497(ample session in)-2.996 F -.2
(vo)-.4 G .497(lving typical usage of the history mechanism of the).2 F
3.101(shell. In)72 502.8 R .601(this e)3.101 F .601(xample we ha)-.15 F
901 -.15(ve a ve)-.2 H .6(ry simple C program which has a b).15 F .6
(ug \(or tw)-.2 F .6(o\) in it in the \214le `b)-.1 F(ug.c',)-.2 E .701
(which we `cat' out on our terminal.)72 514.8 R 2.301 -.8(We t)5.701 H
701(hen try to run the C compiler on it, referring to the \214le ag).8
F .701(ain as)-.05 F .142(`!$', meaning the last ar)72 526.8 R .141
(gument to the pre)-.18 F .141(vious command.)-.25 F .141
(Here the `!' is the history mechanism in)5.141 F -.2(vo)-.4 G(cation).2
E(metacharacter)72 538.8 Q 2.888(,a)-.4 G .389
(nd the `$' stands for the last ar)-2.888 F .389
(gument, by analogy to `$' in the editor which stands for the)-.18 F
1.156(end of the line.)72 550.8 R 1.155
(The shell echoed the command, as it w)6.156 F 1.155(ould ha)-.1 F 1.455
-.15(ve b)-.2 H 1.155(een typed without use of the history).15 F .805
(mechanism, and then e)72 562.8 R -.15(xe)-.15 G .805(cuted it.).15 F
806(The compilation yielded error diagnostics so we no)5.805 F 3.306
(wr)-.25 G .806(un the editor on)-3.306 F .03
(the \214le we were trying to compile, \214x the b)72 574.8 R .03
(ug, and run the C compiler ag)-.2 F .03
(ain, this time referring to this com-)-.05 F .533(mand simply as `!c',\
which repeats the last command which started with the letter `c'.)72
586.8 R .534(If there were other)5.534 F 1.839
(commands starting with `c' done recently we could ha)72 598.8 R 2.139
-.15(ve s)-.2 H 1.839(aid `!cc' or e).15 F -.15(ve)-.25 G 4.338(n`).15 G
1.838(!cc:p' which w)-4.338 F 1.838(ould ha)-.1 F -.15(ve)-.2 G
(printed the last command starting with `cc' without e)72 610.8 Q -.15
(xe)-.15 G(cuting it.).15 E .775(After this recompilation, we ran the r\
esulting `a.out' \214le, and then noting that there still w)97 626.4 R
776(as a b)-.1 F(ug,)-.2 E .585(ran the editor ag)72 638.4 R 3.085
(ain. After)-.05 F .585(\214xing the program we ran the C compiler ag)
3.085 F .585(ain, b)-.05 F .585(ut tack)-.2 F .585(ed onto the command)
-.1 F .747(an e)72 650.4 R .747(xtra `\255o b)-.15 F .748(ug' telling t\
he compiler to place the resultant binary in the \214le `b)-.2 F .748
(ug' rather than `a.out'.)-.2 F(In)5.748 E .255
(general, the history mechanisms may be used an)72 662.4 R .255
(ywhere in the formation of ne)-.15 F 2.755(wc)-.25 G .255
(ommands and other char)-2.755 F(-)-.2 E
(acters may be placed before and after the substituted commands.)72
674.4 Q .32 LW 76 688 72 688 DL 80 688 76 688 DL 84 688 80 688 DL 88 688
84 688 DL 92 688 88 688 DL 96 688 92 688 DL 100 688 96 688 DL 104 688
100 688 DL 108 688 104 688 DL 112 688 108 688 DL 116 688 112 688 DL 120
688 116 688 DL 124 688 120 688 DL 128 688 124 688 DL 132 688 128 688 DL
136 688 132 688 DL 140 688 136 688 DL 144 688 140 688 DL/F3 8
/Times-Roman@0 SF .023(\207The space between the `!' and the w)72 698 R
022(ord `no)-.08 F .022(w' is critical here, as `!no)-.2 F .022(w' w)
-.2 F .022(ould be an in)-.08 F -.16(vo)-.32 G .022(cation of the).16 F
/F4 8/Times-Italic@0 SF(history)2.022 E F3(mechanism,)3.355 E(and ha)72
708 Q .24 -.12(ve a t)-.16 H(otally dif).12 E(ferent ef)-.2 E(fect.)-.2
E EP
%%Page: 14 14
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-14 An)72 52 R
(Introduction to the C shell)2.5 E 2.5(%c)108 90 S(at b)-2.5 E(ug.c)-.2
E(main\(\))108 102 Q({)108 126 Q(printf\("hello\);)133 138 Q(})108 150 Q
2.5(%c)108 162 S 2.5(c!)-2.5 G($)-2.5 E(cc b)108 174 Q(ug.c)-.2 E("b)108
186 Q(ug.c", line 4: ne)-.2 E(wline in string or char constant)-.25 E
("b)108 198 Q(ug.c", line 5: syntax error)-.2 E 2.5(%e)108 210 S 2.5(d!)
-2.5 G($)-2.5 E(ed b)108 222 Q(ug.c)-.2 E(29)108 234 Q(4s/\);/"&/p)108
246 Q(printf\("hello"\);)128 258 Q(w)108 270 Q(30)108 282 Q(q)108 294 Q
2.5(%!)108 306 S(c)-2.5 E(cc b)108 318 Q(ug.c)-.2 E 2.5(%a)108 330 S
(.out)-2.5 E(hello% !e)108 342 Q(ed b)108 354 Q(ug.c)-.2 E(30)108 366 Q
(4s/lo/lo\\\\n/p)108 378 Q(printf\("hello\\n"\);)128 390 Q(w)108 402 Q
(32)108 414 Q(q)108 426 Q 2.5(%!)108 438 S 2.5<63ad>-2.5 G 2.5(ob)-2.5 G
(ug)-2.7 E(cc b)108 450 Q(ug.c \255o b)-.2 E(ug)-.2 E 2.5(%s)108 462 S
(ize a.out b)-2.5 E(ug)-.2 E(a.out: 2784+364+1028 = 4176b = 0x1050b)108
474 Q -.2(bu)108 486 S(g: 2784+364+1028 = 4176b = 0x1050b).2 E 2.5(%l)
108 498 S 2.5<73ad>-2.5 G 2.5(l!)-2.5 G(*)-2.5 E(ls \255l a.out b)108
510 Q(ug)-.2 E/F1 10/Symbol SF(-)108 522 Q F0(rwxr)A F1(-)A F0(xr)A F1
(-)A F0 2.5(x1b)C 15(ill 3932)-2.5 F(Dec 19 09:41 a.out)2.5 E F1(-)108
534 Q F0(rwxr)A F1(-)A F0(xr)A F1(-)A F0 2.5(x1b)C 15(ill 3932)-2.5 F
(Dec 19 09:42 b)2.5 E(ug)-.2 E 2.5(%b)108 546 S(ug)-2.7 E(hello)108 558
Q 2.5(%n)108 570 S(um b)-2.5 E(ug.c | spp)-.2 E(spp: Command not found.)
108 582 Q 2.5(%^)108 594 S(spp^ssp)-2.5 E(num b)108 606 Q(ug.c | ssp)-.2
E 10(1m)118 618 S(ain\(\))-10 E 10(3{)118 630 S 35(4p)118 642 S
(rintf\("hello\\n"\);)-35 E 10(5})118 654 S 2.5(%!)108 666 S 2.5(!|l)
-2.5 G(pr)-2.5 E(num b)108 678 Q(ug.c | ssp | lpr)-.2 E(%)108 690 Q EP
%%Page: 15 15
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-15)271.17 E 2.144 -.8
(We t)97 84 T .544(hen ran the `size' command to see ho).8 F 3.045(wl)
-.25 G(ar)-3.045 E .545(ge the binary program images we ha)-.18 F .845
-.15(ve c)-.2 H .545(reated were,).15 F .034
(and then an `ls \255l' command with the same ar)72 96 R .034
(gument list, denoting the ar)-.18 F .034(gument list `*'.)-.18 F .034
(Finally we ran the)5.034 F(program `b)72 108 Q
(ug' to see that its output is indeed correct.)-.2 E 2.038 -.8(To m)97
123.6 T(ak).8 E -5.437 2.938(ea n)-.1 H .439(umbered listing of the pro\
gram we ran the `num' command on the \214le `b)-2.938 F 2.939(ug.c'. In)
-.2 F(order)2.939 E .263(to compress out blank lines in the output of `\
num' we ran the output through the \214lter `ssp', b)72 135.6 R .263
(ut misspelled)-.2 F .06(it as spp.)72 147.6 R 1.66 -.8(To c)5.06 H .06
(orrect this we used a shell substitute, placing the old te).8 F .061
(xt and ne)-.15 F 2.561(wt)-.25 G -.15(ex)-2.561 G 2.561(tb).15 G .061
(etween `^' characters.)-2.561 F .599
(This is similar to the substitute command in the editor)72 159.6 R
5.599(.F)-.55 G(inally)-5.599 E 3.099(,w)-.65 G 3.099(er)-3.099 G .598
(epeated the same command with `!!',)-3.099 F -.2(bu)72 171.6 S 2.5(ts)
2 G(ent its output to the line printer)-2.5 E(.)-.55 E .899
(There are other mechanisms a)97 187.2 R -.25(va)-.2 G .899
(ilable for repeating commands.).25 F(The)5.9 E/F1 10/Times-Italic@0 SF
(history)3.4 E F0 .9(command prints out a)5.066 F .211(number of pre)72
199.2 R .211(vious commands with numbers by which the)-.25 F 2.711(yc)
-.15 G .211(an be referenced.)-2.711 F .21(There is a w)5.21 F .21
(ay to refer to a)-.1 F(pre)72 211.2 Q .574(vious command by searching \
for a string which appeared in it, and there are other)-.25 F 3.075(,l)
-.4 G .575(ess useful, w)-3.075 F .575(ays to)-.1 F .121(select ar)72
223.2 R .121(guments to include in a ne)-.18 F 2.621(wc)-.25 G 2.621
(ommand. A)-2.621 F .12
(complete description of all these mechanisms is gi)2.621 F -.15(ve)-.25
G 2.62(ni).15 G(n)-2.62 E(the C shell manual pages in the)72 235.2 Q/F2
8/Times-Roman@0 SF(UNIX)2.5 E F0(Programmer')2.5 E 2.5(sM)-.55 G(anual.)
-2.5 E/F3 10/Times-Bold@0 SF 2.5(2.4. Aliases)72 259.2 R F0 .735
(The shell has an)97 274.8 R F1(alias)3.235 E F0 .736
(mechanism which can be used to mak)4.901 F 3.236(et)-.1 G .736
(ransformations on input commands.)-3.236 F 1.481(This mechanism can be\
used to simplify the commands you type, to supply def)72 286.8 R 1.481
(ault ar)-.1 F 1.481(guments to com-)-.18 F .684
(mands, or to perform transformations on commands and their ar)72 298.8
R 3.184(guments. The)-.18 F .684(alias f)3.184 F .684
(acility is similar to a)-.1 F .679(macro f)72 310.8 R(acility)-.1 E
5.679(.S)-.65 G .679(ome of the features obtained by aliasing can be ob\
tained also using shell command \214les,)-5.679 F -.2(bu)72 322.8 S
2.564(tt).2 G .064(hese tak)-2.564 F 2.564(ep)-.1 G .065
(lace in another instance of the shell and cannot directly af)-2.564 F
065(fect the current shells en)-.25 F(vironment)-.4 E(or in)72 334.8 Q
-.2(vo)-.4 G(lv).2 E 2.5(ec)-.15 G(ommands such as)-2.5 E F1(cd)2.5 E F0
(which must be done in the current shell.)4.166 E .669(As an e)97 350.4
R .669(xample, suppose that there is a ne)-.15 F 3.169(wv)-.25 G .669
(ersion of the mail program on the system called `ne)-3.319 F(w-)-.25 E
489(mail' you wish to use, rather than the standard mail program which\
is called `mail'.)72 362.4 R .489(If you place the shell)5.489 F
(command)72 374.4 Q(alias mail ne)108 392.4 Q(wmail)-.25 E(in your)72
410.4 Q F1(.cshr)2.5 E(c)-.37 E F0
(\214le, the shell will transform an input line of the form)4.166 E
(mail bill)108 428.4 Q .283(into a call on `ne)72 446.4 R 2.782
(wmail'. More)-.25 F(generally)2.782 E 2.782(,s)-.65 G .282
(uppose we wish the command `ls' to al)-2.782 F -.1(wa)-.1 G .282
(ys sho).1 F 2.782(ws)-.25 G .282(izes of \214les,)-2.782 F
(that is to al)72 458.4 Q -.1(wa)-.1 G(ys do `\255s'.).1 E 1.6 -.8(We c)
5 H(an do).8 E(alias ls ls \255s)108 476.4 Q(or e)72 494.4 Q -.15(ve)
-.25 G(n).15 E(alias dir ls \255s)108 512.4 Q(creating a ne)72 530.4 Q
2.5(wc)-.25 G(ommand syntax `dir' which does an `ls \255s'.)-2.5 E
(If we say)5 E(dir ~bill)108 548.4 Q
(then the shell will translate this to)72 566.4 Q(ls \255s /mnt/bill)108
584.4 Q 1.459(Thus the)97 606 R F1(alias)3.959 E F0 1.459
(mechanism can be used to pro)5.625 F 1.46
(vide short names for commands, to pro)-.15 F 1.46(vide def)-.15 F(ault)
-.1 E(ar)72 618 Q 1.06(guments, and to de\214ne ne)-.18 F 3.56(ws)-.25 G
1.06(hort commands in terms of other commands.)-3.56 F 1.06
(It is also possible to de\214ne)6.06 F .673
(aliases which contain multiple commands or pipelines, sho)72 630 R .673
(wing where the ar)-.25 F .673(guments to the original com-)-.18 F
(mand are to be substituted using the f)72 642 Q
(acilities of the history mechanism.)-.1 E(Thus the de\214nition)5 E
(alias cd \264cd \\!* ; ls \264)108 660 Q -.1(wo)72 678 S .222
(uld do an).1 F F1(ls)2.722 E F0 .222
(command after each change directory)4.388 F F1(cd)2.722 E F0 2.722
(command. W)4.388 F 2.722(ee)-.8 G .221
(nclosed the entire alias de\214nition)-2.722 F .121
(in `\264' characters to pre)72 690 R -.15(ve)-.25 G .122(nt most subst\
itutions from occurring and the character `;' from being recognized as)
15 F 2.823(am)72 702 S(etacharacter)-2.823 E 5.323(.T)-.55 G .323
(he `!' here is escaped with a `\\' to pre)-5.323 F -.15(ve)-.25 G .322
(nt it from being interpreted when the alias com-).15 F .392
(mand is typed in.)72 714 R .392
(The `\\!*' here substitutes the entire ar)5.392 F .393
(gument list to the pre-aliasing)-.18 F F1(cd)2.893 E F0 .393
(command, with-)4.559 F .665(out gi)72 726 R .665
(ving an error if there were no ar)-.25 F 3.164(guments. The)-.18 F .664
(`;' separating commands is used here to indicate that)3.164 F EP
%%Page: 16 16
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-16 An)72 52 R
(Introduction to the C shell)2.5 E
(one command is to be done and then the ne)72 84 Q 2.5(xt. Similarly)
-.15 F(the de\214nition)2.5 E(alias whois \264grep \\!^ /etc/passwd\264)
108 102 Q(de\214nes a command which looks up its \214rst ar)72 120 Q
(gument in the passw)-.18 E(ord \214le.)-.1 E/F1 10/Times-Bold@0 SF -.65
(Wa)97 135.6 S -.15(rn).65 G(ing:).15 E F0 .205
(The shell currently reads the)2.705 F/F2 10/Times-Italic@0 SF(.cshr)
2.706 E(c)-.37 E F0 .206(\214le each time it starts up.)4.372 F .206
(If you place a lar)5.206 F .206(ge number)-.18 F 1.038
(of commands there, shells will tend to start slo)72 147.6 R(wly)-.25 E
6.037(.A)-.65 G 1.037(mechanism for sa)-2.5 F 1.037(ving the shell en)
-.2 F 1.037(vironment after)-.4 F .214(reading the)72 159.6 R F2(.cshr)
2.714 E(c)-.37 E F0 .215(\214le and quickly restoring it is under de)
2.714 F -.15(ve)-.25 G .215(lopment, b).15 F .215(ut for no)-.2 F 2.715
(wy)-.25 G .215(ou should try to limit the)-2.715 F .594
(number of aliases you ha)72 171.6 R .894 -.15(ve t)-.2 H 3.094(oar).15
G .594(easonable number)-3.094 F .594
(... 10 or 15 is reasonable, 50 or 60 will cause a notice-)-.55 F 1.316
(able delay in starting up shells, and mak)72 183.6 R 3.816(et)-.1 G
1.316(he system seem sluggish when you e)-3.816 F -.15(xe)-.15 G 1.317
(cute commands from).15 F(within the editor and other programs.)72 195.6
Q F1 2.5(2.5. Mor)72 219.6 R 2.5(er)-.18 G(edir)-2.68 E
(ection; >> and >&)-.18 E F0(There are a fe)97 235.2 Q 2.5(wm)-.25 G
(ore notations useful to the terminal user which ha)-2.5 E .3 -.15(ve n)
-.2 H(ot been introduced yet.).15 E 2.181
(In addition to the standard output, commands also ha)97 250.8 R 2.48
-.15(ve a)-.2 H F2(dia)4.83 E 2.18(gnostic output)-.1 F F0 2.18
(which is normally)6.346 F .934(directed to the terminal e)72 262.8 R
-.15(ve)-.25 G 3.434(nw).15 G .934
(hen the standard output is redirected to a \214le or a pipe.)-3.434 F
935(It is occasionally)5.935 F .119(desirable to direct the diagnostic\
output along with the standard output.)72 274.8 R -.15(Fo)5.119 G 2.619
(ri).15 G .119(nstance if you w)-2.619 F .118(ant to redirect)-.1 F .611
(the output of a long running command into a \214le and wish to ha)72
286.8 R .912 -.15(ve a r)-.2 H .612(ecord of an).15 F 3.112(ye)-.15 G
612(rror diagnostic it pro-)-3.112 F(duces you can do)72 298.8 Q
(command >& \214le)108 316.8 Q .725(The `>&' here tells the shell to ro\
ute both the diagnostic output and the standard output into `\214le'.)72
334.8 R(Simi-)5.725 E(larly you can gi)72 346.8 Q .3 -.15(ve t)-.25 H
(he command).15 E(command |)108 364.8 Q 2.5(&l)1.666 G(pr)-2.5 E(to rou\
te both standard and diagnostic output through the pipe to the line pri\
nter daemon)72 382.8 Q F2(lpr)2.5 E<2e88>-1.11 E F0(Finally)97 398.4 Q
2.5(,i)-.65 G 2.5(ti)-2.5 G 2.5(sp)-2.5 G(ossible to use the form)-2.5 E
(command >> \214le)108 416.4 Q(to place output at the end of an e)72
434.4 Q(xisting \214le.\207)-.15 E F1 2.5(2.6. J)72 458.4 R(obs; Backgr)
-.15 E(ound, F)-.18 E(or)-.25 E(egr)-.18 E(ound, or Suspended)-.18 E F0
663(When one or more commands are typed together as a pipeline or as a\
sequence of commands sepa-)97 474 R .761(rated by semicolons, a single)
72 486 R F2(job)3.262 E F0 .762(is created by the shell consisting of t\
hese commands together as a unit.)4.928 F 1.168
(Single commands without pipes or semicolons create the simplest jobs.)
72 498 R(Usually)6.168 E 3.668(,e)-.65 G -.15(ve)-3.918 G 1.168
(ry line typed to the).15 F(shell creates a job)72 510 Q 5(.S)-.4 G
(ome lines that create jobs \(one per line\) are)-5 E(sort < data)108
528 Q(ls \255s | sort \255n | head \2555)108 540 Q(mail harold)108 552 Q
202(If the metacharacter `&' is typed at the end of the commands, then\
the job is started as a)97 573.6 R F2(bac)2.703 E(kgr)-.2 E(ound)-.45 E
F0(job)72 585.6 Q 5.919(.T)-.4 G .919
(his means that the shell does not w)-5.919 F .918
(ait for it to complete b)-.1 F .918
(ut immediately prompts and is ready for)-.2 F .852(another command.)72
597.6 R .852(The job runs)5.852 F F2 .852(in the bac)3.352 F(kgr)-.2 E
(ound)-.45 E F0 .853(at the same time that normal jobs, called)5.018 F
F2(for)3.353 E -.4(eg)-.37 G -.45(ro).4 G(und).45 E F0
(jobs, continue to be read and e)72 609.6 Q -.15(xe)-.15 G
(cuted by the shell one at a time.).15 E(Thus)5 E(du > usage &)108 627.6
Q .32 LW 76 638 72 638 DL 80 638 76 638 DL 84 638 80 638 DL 88 638 84
638 DL 92 638 88 638 DL 96 638 92 638 DL 100 638 96 638 DL 104 638 100
638 DL 108 638 104 638 DL 112 638 108 638 DL 116 638 112 638 DL 120 638
116 638 DL 124 638 120 638 DL 128 638 124 638 DL 132 638 128 638 DL 136
638 132 638 DL 140 638 136 638 DL 144 638 140 638 DL/F3 8/Times-Roman@0
SF 2(\210Ac)72 648 S(ommand of the form)-2 E(command >&! \214le)112 658
Q -.12(ex)72 668 S(ists, and is used when).12 E/F4 8/Times-Italic@0 SF
(noclobber)2 E F3(is set and)3.333 E F4(\214le)2 E F3(already e)3.333 E
(xists.)-.12 E 2.221<8749>72 678 S(f)-2.221 E F4(noclobber)2.221 E F3
222(is set, then an error will result if)3.554 F F4(\214le)2.222 E F3
222(does not e)3.555 F .222(xist, otherwise the shell will create)-.12
F F4(\214le)2.222 E F3 .222(if it doesn')3.555 F 2.222(te)-.144 G 2.222
(xist. A)-2.342 F(form)72 688 Q(command >>! \214le)112 698 Q(mak)72 708
Q(es it not be an error for \214le to not e)-.08 E(xist when)-.12 E F4
(noclobber)2 E F3(is set.)3.333 E EP
%%Page: 17 17
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-17)271.17 E -.1(wo)72 84 S
07(uld run the).1 F/F1 10/Times-Italic@0 SF(du)2.57 E F0 .07
(program, which reports on the disk usage of your w)4.236 F .069
(orking directory \(as well as an)-.1 F 2.569(yd)-.15 G(irec-)-2.569 E
274(tories belo)72 96 R 2.774(wi)-.25 G .275(t\), put the output into \
the \214le `usage' and return immediately with a prompt for the ne)
-2.774 F .275(xt com-)-.15 F .749(mand without out w)72 108 R .749
(aiting for)-.1 F F1(du)3.249 E F0 .749(to \214nish.)4.915 F(The)5.749 E
F1(du)3.249 E F0 .748(program w)4.915 F .748(ould continue e)-.1 F -.15
(xe)-.15 G .748(cuting in the background).15 F .724
(until it \214nished, e)72 120 R -.15(ve)-.25 G 3.224(nt).15 G .724
(hough you can type and e)-3.224 F -.15(xe)-.15 G .725
(cute more commands in the mean time.).15 F .725(When a back-)5.725 F
641(ground job terminates, a message is typed by the shell just before\
the ne)72 132 R .641(xt prompt telling you that the job)-.15 F 1.004
(has completed.)72 144 R 1.004(In the follo)6.004 F 1.004(wing e)-.25 F
1.004(xample the)-.15 F F1(du)3.504 E F0 1.004
(job \214nishes sometime during the e)5.17 F -.15(xe)-.15 G 1.005
(cution of the).15 F F1(mail)3.505 E F0(command and its completion is r\
eported just before the prompt after the)72 156 Q F1(mail)2.5 E F0
(job is \214nished.)4.166 E 2.5(%d)108 174 S 2.5(u>u)-2.5 G(sage &)-2.5
E([1] 503)108 186 Q 2.5(%m)108 198 S(ail bill)-2.5 E(Ho)108 210 Q 2.5
(wd)-.25 G 2.5(oy)-2.5 G(ou kno)-2.5 E 2.5(ww)-.25 G
(hen a background job is \214nished?)-2.5 E(EO)108 222 Q(T)-.4 E
([1] \255 Done)108 234 Q(du > usage)82.04 E(%)108 246 Q .992(If the job\
did not terminate normally the `Done' message might say something else\
lik)72 264 R 3.492(e`)-.1 G 3.492(Killed'. If)-3.492 F(you)3.492 E -.1
(wa)72 276 S .942
(nt the terminations of background jobs to be reported at the time the)
1 F 3.443(yo)-.15 G .943(ccur \(possibly interrupting the)-3.443 F .305
(output of other fore)72 288 R .305(ground jobs\), you can set the)-.15
F F1(notify)2.805 E F0 -.25(va)4.471 G 2.805(riable. In).25 F .305
(the pre)2.805 F .305(vious e)-.25 F .305(xample this w)-.15 F .304
(ould mean)-.1 F .411(that the `Done' message might ha)72 300 R .711
-.15(ve c)-.2 H .411(ome right in the middle of the message to Bill.).15
F .412(Background jobs are)5.411 F(unaf)72 312 Q(fected by an)-.25 E 2.5
(ys)-.15 G(ignals from the k)-2.5 E -.15(ey)-.1 G(board lik).15 E 2.5
(et)-.1 G(he)-2.5 E/F2 8/Times-Roman@0 SF(ST)2.5 E(OP)-.144 E F0(,)A F2
(INTERR)2.5 E(UPT)-.32 E F0 2.5(,o)C(r)-2.5 E F2 -.08(QU)2.5 G(IT).08 E
F0(signals mentioned earlier)2.5 E(.)-.55 E .849
(Jobs are recorded in a table inside the shell until the)97 327.6 R
3.349(yt)-.15 G 3.349(erminate. In)-3.349 F .848
(this table, the shell remembers)3.349 F .484(the command names, ar)72
339.6 R .484(guments and the)-.18 F F1(pr)2.984 E .485(ocess number)-.45
F(s)-.1 E F0 .485(of all commands in the job as well as the w)4.651 F
(ork-)-.1 E .573(ing directory where the job w)72 351.6 R .573
(as started.)-.1 F .572(Each job in the table is either running)5.572 F
F1 .572(in the for)3.072 F -.4(eg)-.37 G -.45(ro).4 G(und).45 E F0 .572
(with the)4.738 F .386(shell w)72 363.6 R .386
(aiting for it to terminate, running)-.1 F F1 .386(in the bac)2.886 F
(kgr)-.2 E(ound,)-.45 E F0(or)4.553 E F1(suspended.)2.887 E F0 .387
(Only one job can be running in)4.553 F .975(the fore)72 375.6 R .975
(ground at one time, b)-.15 F .975(ut se)-.2 F -.15(ve)-.25 G .975
(ral jobs can be suspended or running in the background at once.).15 F
(As)5.975 E .284(each job is started, it is assigned a small identifyin\
g number called the)72 387.6 R F1 .284(job number)2.784 F F0 .284
(which can be used later)4.45 F .195
(to refer to the job in the commands described belo)72 399.6 R 3.995
-.65(w. J)-.25 H .195
(ob numbers remain the same until the job terminates).65 F
(and then are re-used.)72 411.6 Q .611
(When a job is started in the backgound using `&', its number)97 427.2 R
3.112(,a)-.4 G 3.112(sw)-3.112 G .612(ell as the process numbers of all)
-3.112 F(its \(top le)72 439.2 Q -.15(ve)-.25 G(l\) commands, is typed \
by the shell before prompting you for another command. F).15 E(or e)-.15
E(xample,)-.15 E 2.5(%l)108 457.2 S 2.5<73ad>-2.5 G 2.5(s|s)-2.5 G
(ort \255n > usage &)-2.5 E([2] 2034 2035)108 469.2 Q(%)108 481.2 Q .828
(runs the `ls' program with the `\255s' options, pipes this output into\
the `sort' program with the `\255n' option)72 499.2 R 1.07
(which puts its output into the \214le `usage'.)72 511.2 R 1.07
(Since the `&' w)6.07 F 1.071(as at the end of the line, these tw)-.1 F
3.571(op)-.1 G(rograms)-3.571 E .097
(were started together as a background job)72 523.2 R 5.097(.A)-.4 G
096(fter starting the job, the shell prints the job number in brack)
-5.097 F(ets)-.1 E .274(\(2 in this case\) follo)72 535.2 R .275
(wed by the process number of each program started in the job)-.25 F
5.275(.T)-.4 G .275(hen the shell immedi-)-5.275 F
(ates prompts for a ne)72 547.2 Q 2.5(wc)-.25 G(ommand, lea)-2.5 E
(ving the job running simultaneously)-.2 E(.)-.65 E .945
(As mentioned in section 1.8, fore)97 562.8 R .945(ground jobs become)
-.15 F F1(suspended)3.445 E F0 .944(by typing ^Z which sends a)5.11 F F2
(ST)3.444 E(OP)-.144 E F0 .197(signal to the currently running fore)72
574.8 R .198(ground job)-.15 F 5.198(.A)-.4 G .198
(background job can become suspended by using the)-2.5 F F1(stop)2.698 E
F0 1.028(command described belo)72 586.8 R 4.828 -.65(w. W)-.25 H 1.028
(hen jobs are suspended the).65 F 3.528(ym)-.15 G 1.028(erely stop an)
-3.528 F 3.528(yf)-.15 G 1.027(urther progress until started)-3.528 F
(ag)72 598.8 Q 1.826(ain, either in the fore)-.05 F 1.826
(ground or the backgound.)-.15 F 1.826
(The shell notices when a job becomes stopped and)6.826 F .975
(reports this f)72 610.8 R .975(act, much lik)-.1 F 3.475(ei)-.1 G 3.475
(tr)-3.475 G .974(eports the termination of background jobs.)-3.475 F
-.15(Fo)5.974 G 3.474(rf).15 G(ore)-3.474 E .974(ground jobs this looks)
-.15 F(lik)72 622.8 Q(e)-.1 E 2.5(%d)108 640.8 S 2.5(u>u)-2.5 G(sage)
-2.5 E(^Z)108 652.8 Q(Stopped)108 664.8 Q(%)108 676.8 Q .096
(`Stopped' message is typed by the shell when it notices that the)72
694.8 R F1(du)2.596 E F0 .096(program stopped.)4.262 F -.15(Fo)5.096 G
2.597(rb).15 G .097(ackground jobs,)-2.597 F(using the)72 706.8 Q F1
(stop)2.5 E F0(command, it is)4.166 E EP
%%Page: 18 18
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-18 An)72 52 R
(Introduction to the C shell)2.5 E 2.5(%s)108 90 S(ort usage &)-2.5 E
([1] 2345)108 102 Q 2.5(%s)108 114 S(top %1)-2.5 E
([1] + Stopped \(signal\))108 126 Q(sort usage)37.87 E(%)108 138 Q .705
(Suspending fore)72 156 R .705(ground jobs can be v)-.15 F .704
(ery useful when you need to temporarily change what you are doing)-.15
F(\(e)72 168 Q -.15(xe)-.15 G .788
(cute other commands\) and then return to the suspended job).15 F 5.788
(.A)-.4 G .788(lso, fore)-5.788 F .788(ground jobs can be suspended)-.15
F .862(and then continued as background jobs using the)72 180 R/F1 10
/Times-Italic@0 SF(bg)3.362 E F0 .861(command, allo)5.027 F .861
(wing you to continue other w)-.25 F .861(ork and)-.1 F(stop w)72 192 Q
(aiting for the fore)-.1 E(ground job to \214nish.)-.15 E(Thus)5 E 2.5
(%d)108 210 S 2.5(u>u)-2.5 G(sage)-2.5 E(^Z)108 222 Q(Stopped)108 234 Q
2.5(%b)108 246 S(g)-2.5 E([1] du > usage &)108 258 Q(%)108 270 Q .65
(starts `du' in the fore)72 288 R .65(ground, stops it before it \214ni\
shes, then continues it in the background allo)-.15 F .65(wing more)-.25
F(fore)72 300 Q 1.345(ground commands to be e)-.15 F -.15(xe)-.15 G
3.845(cuted. This).15 F 1.345(is especially helpful when a fore)3.845 F
1.344(ground job ends up taking)-.15 F(longer than you e)72 312 Q
(xpected and you wish you had started it in the backgound in the be)-.15
E(ginning.)-.15 E(All)97 327.6 Q F1 .661(job contr)3.161 F(ol)-.45 E F0
661(commands can tak)4.827 F 3.161(ea)-.1 G 3.161(na)-3.161 G -.18(rg)
-3.161 G .662(ument that identi\214es a particular job).18 F 5.662(.A)
-.4 G .662(ll job name ar)-5.662 F(gu-)-.18 E .574(ments be)72 339.6 R
574(gin with the character `%', since some of the job control commands\
also accept process numbers)-.15 F .236(\(printed by the)72 351.6 R F1
(ps)2.736 E F0 2.736(command.\) The)4.402 F(def)2.737 E .237
(ault job \(when no ar)-.1 F .237(gument is gi)-.18 F -.15(ve)-.25 G
237(n\) is called the).15 F F1(curr)2.737 E(ent)-.37 E F0 .237
(job and is)4.403 F .427(identi\214ed by a `+' in the output of the)72
363.6 R F1(jobs)2.927 E F0 .426(command, which sho)4.593 F .426
(ws you which jobs you ha)-.25 F -.15(ve)-.2 G 5.426(.W).15 G .426
(hen only)-5.426 F .622(one job is stopped or running in the background\
\(the usual case\) it is al)72 375.6 R -.1(wa)-.1 G .622
(ys the current job thus no ar).1 F(gu-)-.18 E 1.174(ment is needed.)72
387.6 R 1.173(If a job is stopped while running in the fore)6.174 F
1.173(ground it becomes the)-.15 F F1(curr)3.673 E(ent)-.37 E F0 1.173
(job and the)5.339 F -.15(ex)72 399.6 S .368
(isting current job becomes the).15 F F1(pr)2.868 E -.15(ev)-.37 G(ious)
15 E F0 .368(job \255 identi\214ed by a `\255' in the output of)4.534 F
F1(jobs.)2.869 E F0 .369(When the current)4.535 F .063
(job terminates, the pre)72 411.6 R .063
(vious job becomes the current job)-.25 F 5.062(.W)-.4 G .062(hen gi)
-5.062 F -.15(ve)-.25 G .062(n, the ar).15 F .062
(gument is either `%\255' \(indicat-)-.18 F .971(ing the pre)72 423.6 R
971(vious job\); `%#', where # is the job number; `%pref)-.25 F 3.471
('w).55 G .971(here pref is some unique pre\214x of the)-3.471 F .069
(command name and ar)72 435.6 R .069
(guments of one of the jobs; or `%?' follo)-.18 F .069
(wed by some string found in only one of the)-.25 F(jobs.)72 447.6 Q
(The)97 463.2 Q F1(jobs)3.141 E F0 .641
(command types the table of jobs, gi)4.807 F .642(ving the job number)
-.25 F 3.142(,c)-.4 G .642(ommands and status \(`Stopped')-3.142 F 1.494
(or `Running'\) of each backgound or suspended job)72 475.2 R 6.494(.W)
-.4 G 1.494(ith the `\255l' option the process numbers are also)-6.894 F
(typed.)72 487.2 Q 2.5(%d)108 505.2 S 2.5(u>u)-2.5 G(sage &)-2.5 E
([1] 3398)108 517.2 Q 2.5(%l)108 529.2 S 2.5<73ad>-2.5 G 2.5(s|s)-2.5 G
(ort \255n > my\214le &)-2.5 E([2] 3405)108 541.2 Q 2.5(%m)108 553.2 S
(ail bill)-2.5 E(^Z)108 565.2 Q(Stopped)108 577.2 Q 2.5(%j)108 589.2 S
(obs)-2.5 E([1])108 601.2 Q/F2 10/Symbol SF(-)2.5 E F0 66.9(Running du)
2.5 F 2.5(>u)2.5 G(sage)-2.5 E 7.5([2] Running)108 613.2 R
(ls \255s | sort \255n > my\214le)69.89 E([3])108 625.2 Q F2(+)2.5 E F0
68.57(Stopped mail)2.5 F(bill)2.5 E 2.5(%f)108 637.2 S 2.5(g%)-2.5 G(ls)
-2.5 E(ls \255s | sort \255n > my\214le)108 649.2 Q 2.5(%m)108 661.2 S
(ore my\214le)-2.5 E(The)97 682.8 Q F1(fg)2.76 E F0 .261
(command runs a suspended or background job in the fore)4.426 F 2.761
(ground. It)-.15 F .261(is used to restart a pre)2.761 F(vi-)-.25 E .749
(ously suspended job or change a background job to run in the fore)72
694.8 R .749(ground \(allo)-.15 F .748(wing signals or input from)-.25 F
1.083(the terminal\).)72 706.8 R 1.084(In the abo)6.083 F 1.384 -.15
(ve ex)-.15 H 1.084(ample we used).15 F F1(fg)3.584 E F0 1.084
(to change the `ls' job from the background to the fore-)5.25 F .807
(ground since we w)72 718.8 R .807(anted to w)-.1 F .806
(ait for it to \214nish before looking at its output \214le.)-.1 F(The)
5.806 E F1(bg)3.306 E F0 .806(command runs a)4.972 F 1.239
(suspended job in the background.)72 730.8 R 1.239
(It is usually used after stopping the currently running fore)6.239 F
1.24(ground job)-.15 F EP
%%Page: 19 19
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-19)271.17 E .607(with the)
72 84 R/F1 8/Times-Roman@0 SF(ST)3.107 E(OP)-.144 E F0 3.107
(signal. The)3.107 F .607(combination of the)3.107 F F1(ST)3.107 E(OP)
-.144 E F0 .607(signal and the)3.107 F/F2 10/Times-Italic@0 SF(bg)3.106
E F0 .606(command changes a fore)4.772 F .606(ground job)-.15 F
(into a background job)72 96 Q 5(.T)-.4 G(he)-5 E F2(stop)2.5 E F0
(command suspends a background job)4.166 E(.)-.4 E(The)97 111.6 Q F2
(kill)3.822 E F0 1.322
(command terminates a background or suspended job immediately)5.488 F
6.323(.I)-.65 G 3.823(na)-6.323 G 1.323(ddition to jobs, it)-3.823 F
265(may be gi)72 123.6 R -.15(ve)-.25 G 2.765(np).15 G .265
(rocess numbers as ar)-2.765 F .264(guments, as printed by)-.18 F F2
(ps.)2.764 E F0 .264(Thus, in the e)4.43 F .264(xample abo)-.15 F -.15
(ve)-.15 G 2.764(,t).15 G .264(he running)-2.764 F F2(du)2.764 E F0
(command could ha)72 135.6 Q .3 -.15(ve b)-.2 H
(een terminated by the command).15 E 2.5(%k)108 153.6 S(ill %1)-2.5 E
2.5([1] T)108 165.6 R 61.44(erminated du)-.7 F 2.5(>u)2.5 G(sage)-2.5 E
(%)108 177.6 Q(The)97 199.2 Q F2(notify)3.141 E F0 .641
(command \(not the v)4.807 F .642(ariable mentioned earlier\) indicates\
that the termination of a speci\214c)-.25 F
(job should be reported at the time it \214nishes instead of w)72 211.2
Q(aiting for the ne)-.1 E(xt prompt.)-.15 E .839(If a job running in th\
e background tries to read input from the terminal it is automatically \
stopped.)97 226.8 R .361(When such a job is then run in the fore)72
238.8 R .361(ground, input can be gi)-.15 F -.15(ve)-.25 G 2.861(nt).15
G 2.861(ot)-2.861 G .361(he job)-2.861 F 5.361(.I)-.4 G 2.861(fd)-5.361
G .361(esired, the job can be run)-2.861 F .027(in the background ag)72
250.8 R .027(ain until it requests input ag)-.05 F 2.526(ain. This)-.05
F .026(is illustrated in the follo)2.526 F .026(wing sequence where the)
-.25 F(`s' command in the te)72 262.8 Q(xt editor might tak)-.15 E 2.5
(eal)-.1 G(ong time.)-2.5 E 2.5(%e)108 280.8 S 2.5(db)-2.5 G(ig\214le)
-2.5 E(120000)108 292.8 Q(1,$s/thisw)108 304.8 Q(ord/thatw)-.1 E(ord/)
-.1 E(^Z)108 316.8 Q(Stopped)108 328.8 Q 2.5(%b)108 340.8 S(g)-2.5 E
([1] ed big\214le &)108 352.8 Q(%)108 364.8 Q -2.5 2.5(... s)110.5 376.8
T(ome fore)-2.5 E(ground commands)-.15 E([1] Stopped \(tty input\))108
388.8 Q(ed big\214le)36.28 E 2.5(%f)108 400.8 S(g)-2.5 E(ed big\214le)
108 412.8 Q(w)108 424.8 Q(120000)108 436.8 Q(q)108 448.8 Q(%)108 460.8 Q
1.259(So after the `s' command w)72 478.8 R 1.259
(as issued, the `ed' job w)-.1 F 1.26
(as stopped with ^Z and then put in the background)-.1 F(using)72 490.8
Q F2(bg)2.82 E(.)-.15 E F0 .32(Some time later when the `s' command w)
4.486 F .319(as \214nished,)-.1 F F2(ed)2.819 E F0 .319
(tried to read another command and w)4.485 F(as)-.1 E .547
(stopped because jobs in the backgound cannot read from the terminal.)72
502.8 R(The)5.547 E F2(fg)3.047 E F0 .548(command returned the `ed')
4.713 F(job to the fore)72 514.8 Q(ground where it could once ag)-.15 E
(ain accept commands from the terminal.)-.05 E(The command)97 530.4 Q
(stty tostop)108 548.4 Q .116
(causes all background jobs run on your terminal to stop when the)72
566.4 R 2.616(ya)-.15 G .115(re about to write output to the terminal.)
-2.616 F .877(This pre)72 578.4 R -.15(ve)-.25 G .878
(nts messages from background jobs from interrupting fore).15 F .878
(ground job output and allo)-.15 F .878(ws you to)-.25 F .013
(run a job in the background without losing terminal output.)72 590.4 R
013(It also can be used for interacti)5.013 F .312 -.15(ve p)-.25 H
012(rograms that).15 F .253(sometimes ha)72 602.4 R .553 -.15(ve l)-.2
H .253(ong periods without interaction.).15 F .254
(Thus each time it outputs a prompt for more input it will)5.253 F .329
(stop before the prompt.)72 614.4 R .328(It can then be run in the fore)
5.329 F .328(ground using)-.15 F F2(fg)2.828 E(,)-.1 E F0 .328
(more input can be gi)4.494 F -.15(ve)-.25 G 2.828(na).15 G .328
(nd, if nec-)-2.828 F .761
(essary stopped and returned to the background.)72 626.4 R(This)5.761 E
F2(stty)3.261 E F0 .762(command might be a good thing to put in your)
4.927 F F2(.lo)72 638.4 Q(gin)-.1 E F0 .887(\214le if you do not lik)
5.053 F 3.386(eo)-.1 G .886
(utput from background jobs interrupting your w)-3.386 F 3.386(ork. It)
-.1 F .886(also can reduce the)3.386 F(need for redirecting the output \
of background jobs if the output is not v)72 650.4 Q(ery big:)-.15 E EP
%%Page: 20 20
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-20 An)72 52 R
(Introduction to the C shell)2.5 E 2.5(%s)108 90 S(tty tostop)-2.5 E 2.5
(%w)108 102 S 2.5(ch)-2.5 G(uge\214le &)-2.5 E([1] 10387)108 114 Q 2.5
(%e)108 126 S 2.5(dt)-2.5 G -.15(ex)-2.5 G(t).15 E 2.5(...s)108 138 S
(ome time later)-2.5 E(q)108 150 Q([1] Stopped \(tty output\))108 162 Q
(wc huge\214le)31.28 E 2.5(%f)108 174 S 2.5(gw)-2.5 G(c)-2.5 E
(wc huge\214le)108 186 Q 5(13371 30123 302577)115.5 198 R 2.5(%s)108 210
S(tty \255tostop)-2.5 E .97
(Thus after some time the `wc' command, which counts the lines, w)72 228
R .97(ords and characters in a \214le, had one)-.1 F .581
(line of output.)72 240 R .581
(When it tried to write this to the terminal it stopped.)5.581 F .581
(By restarting it in the fore)5.581 F .581(ground we)-.15 F(allo)72 252
Q 1.494(wed it to write on the terminal e)-.25 F 1.495
(xactly when we were ready to look at its output.)-.15 F 1.495
(Programs which)6.495 F .388(attempt to change the mode of the terminal\
will also block, whether or not)72 264 R/F1 10/Times-Italic@0 SF
(tostop)2.888 E F0 .387(is set, when the)4.553 F 2.887(ya)-.15 G .387
(re not)-2.887 F .163(in the fore)72 276 R .163(ground, as it w)-.15 F
163(ould be v)-.1 F .164(ery unpleasant to ha)-.15 F .464 -.15(ve a b)
-.2 H .164(ackground job change the state of the terminal.).15 F 1.023
(Since the)97 291.6 R F1(jobs)3.523 E F0 1.023
(command only prints jobs started in the currently e)5.189 F -.15(xe)
-.15 G 1.023(cuting shell, it kno).15 F 1.022(ws nothing)-.25 F .443(ab\
out background jobs started in other login sessions or within shell \
\214les.)72 303.6 R(The)5.443 E F1(ps)2.944 E F0 .444
(can be used in this case)4.61 F
(to \214nd out about background jobs not started in the current shell.)
72 315.6 Q/F2 10/Times-Bold@0 SF 2.5(2.7. W)72 339.6 R(orking Dir)-.75 E
(ectories)-.18 E F0 .217(As mentioned in section 1.6, the shell is al)97
355.2 R -.1(wa)-.1 G .216(ys in a particular).1 F F1 .216(working dir)
2.716 F(ectory)-.37 E(.)-.55 E F0 .216(The `change direc-)4.382 F .391
(tory' command)72 367.2 R F1 -.15(ch)2.891 G(dir).15 E F0 .391
(\(its short form)4.557 F F1(cd)2.891 E F0 .391
(may also be used\) changes the w)4.557 F .391
(orking directory of the shell, that)-.1 F
(is, changes the directory you are located in.)72 379.2 Q .598
(It is useful to mak)97 394.8 R 3.098(ead)-.1 G .598
(irectory for each project you wish to w)-3.098 F .597
(ork on and to place all \214les related to)-.1 F 1.157
(that project in that directory)72 406.8 R 6.157(.T)-.65 G 1.157
(he `mak)-6.157 F 3.657(ed)-.1 G 1.157(irectory' command,)-3.657 F F1
(mkdir)3.657 E(,)-1.11 E F0 1.157(creates a ne)5.323 F 3.658(wd)-.25 G
(irectory)-3.658 E 6.158(.T)-.65 G(he)-6.158 E F1(pwd)3.658 E F0 .858
(\(`print w)72 418.8 R .857
(orking directory'\) command reports the absolute pathname of the w)-.1
F .857(orking directory of the shell,)-.1 F
(that is, the directory you are located in.)72 430.8 Q(Thus in the e)5 E
(xample belo)-.15 E(w:)-.25 E 2.5(%p)108 448.8 S(wd)-2.5 E(/usr/bill)108
460.8 Q 2.5(%m)108 472.8 S(kdir ne)-2.5 E(wpaper)-.25 E 2.5(%c)108 484.8
S(hdir ne)-2.5 E(wpaper)-.25 E 2.5(%p)108 496.8 S(wd)-2.5 E
(/usr/bill/ne)108 508.8 Q(wpaper)-.25 E(%)108 520.8 Q .628
(the user has created and mo)72 538.8 R -.15(ve)-.15 G 3.128(dt).15 G
3.128(ot)-3.128 G .628(he directory)-3.128 F F1(ne)3.129 E(wpaper)-.15 E
(.)-1.11 E F0 .629(where, for e)4.795 F .629
(xample, he might place a group of)-.15 F(related \214les.)72 550.8 Q
1.052(No matter where you ha)97 566.4 R 1.352 -.15(ve m)-.2 H -.15(ove)
15 G 3.552(dt).15 G 3.552(oi)-3.552 G 3.552(nad)-3.552 G 1.052
(irectory hierarch)-3.552 F 2.352 -.65(y, y)-.05 H 1.051
(ou can return to your `home' login).65 F(directory by doing just)72
578.4 Q(cd)108 596.4 Q(with no ar)72 614.4 Q 2.5(guments. The)-.18 F
(name `..)2.5 E 2.5('a)-.7 G -.1(lwa)-2.5 G(ys means the directory abo)
1 E .3 -.15(ve t)-.15 H(he current one in the hierarch).15 E 1.3 -.65
(y, t)-.05 H(hus).65 E(cd ..)108 632.4 Q .517(changes the shell')72
650.4 R 3.017(sw)-.55 G .517(orking directory to the one directly abo)
-3.117 F .817 -.15(ve t)-.15 H .517(he current one.).15 F .517
(The name `..)5.517 F 3.018('c)-.7 G .518(an be used)-3.018 F(in an)72
662.4 Q 2.5(yp)-.15 G(athname, thus,)-2.5 E(cd ../programs)108 680.4 Q
1.18(means change to the directory `programs' contained in the director\
y abo)72 698.4 R 1.479 -.15(ve t)-.15 H 1.179(he current one.).15 F
1.179(If you ha)6.179 F -.15(ve)-.2 G(se)72 710.4 Q -.15(ve)-.25 G 1.28
(ral directories for dif).15 F 1.281(ferent projects under)-.25 F 3.781
(,s)-.4 G(ay)-3.781 E 3.781(,y)-.65 G 1.281(our home directory)-3.781 F
3.781(,t)-.65 G 1.281(his shorthand notation permits)-3.781 F
(you to switch easily between them.)72 722.4 Q EP
%%Page: 21 21
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-21)271.17 E .583
(The shell al)97 84 R -.1(wa)-.1 G .583
(ys remembers the pathname of its current w).1 F .583
(orking directory in the v)-.1 F(ariable)-.25 E/F1 10/Times-Italic@0 SF
(cwd.)3.083 E F0(The)4.748 E .698
(shell can also be requested to remember the pre)72 96 R .698
(vious directory when you change to a ne)-.25 F 3.199(ww)-.25 G .699
(orking direc-)-3.299 F(tory)72 108 Q 5.25(.I)-.65 G 2.75(ft)-5.25 G .25
(he `push directory' command)-2.75 F F1(pushd)2.75 E F0 .249
(is used in place of the)4.416 F F1(cd)2.749 E F0 .249
(command, the shell sa)4.415 F -.15(ve)-.2 G 2.749(st).15 G .249
(he name)-2.749 F .318(of the current w)72 120 R .318
(orking directory on a)-.1 F F1(dir)2.818 E .319(ectory stac)-.37 F(k)
-.2 E F0 .319(before changing to the ne)4.485 F 2.819(wo)-.25 G 2.819
(ne. Y)-2.819 F .319(ou can see this list)-1.1 F(at an)72 132 Q 2.5(yt)
-.15 G(ime by typing the `directories' command)-2.5 E F1(dir)2.5 E(s.)
-.1 E F0 2.5(%p)108 150 S(ushd ne)-2.5 E(wpaper/references)-.25 E(~/ne)
108 162 Q 2.5(wpaper/references ~)-.25 F 2.5(%p)108 174 S
(ushd /usr/lib/tmac)-2.5 E 2.5(/usr/lib/tmac ~/ne)108 186 R 2.5
(wpaper/references ~)-.25 F 2.5(%d)108 198 S(irs)-2.5 E 2.5
(/usr/lib/tmac ~/ne)108 210 R 2.5(wpaper/references ~)-.25 F 2.5(%p)108
222 S(opd)-2.5 E(~/ne)108 234 Q 2.5(wpaper/references ~)-.25 F 2.5(%p)
108 246 S(opd)-2.5 E(~)108 258 Q(%)108 270 Q .032(The list is printed i\
n a horizontal line, reading left to right, with a tilde \(~\) as short\
hand for your home direc-)72 288 R .198
(tory\212in this case `/usr/bill'.)72 300 R .199
(The directory stack is printed whene)5.199 F -.15(ve)-.25 G 2.699(rt)
15 G .199(here is more than one entry on it and)-2.699 F .955
(it changes.)72 312 R .955(It is also printed by a)5.955 F F1(dir)3.455
E(s)-.1 E F0(command.)5.121 E F1(Dir)5.955 E(s)-.1 E F0 .954
(is usually f)5.12 F .954(aster and more informati)-.1 F 1.254 -.15
(ve t)-.25 H(han).15 E F1(pwd)3.454 E F0(since it sho)72 324 Q
(ws the current w)-.25 E(orking directory as well as an)-.1 E 2.5(yo)
-.15 G(ther directories remembered in the stack.)-2.5 E(The)97 339.6 Q
F1(pushd)2.964 E F0 .464(command with no ar)4.63 F .464(gument alternat\
es the current directory with the \214rst directory in the)-.18 F 3.856
(list. The)72 351.6 R 1.356(`pop directory')3.856 F F1(popd)3.856 E F0
1.355(command without an ar)5.521 F 1.355
(gument returns you to the directory you were in)-.18 F 1.368
(prior to the current one, discarding the pre)72 363.6 R 1.369
(vious current directory from the stack \(for)-.25 F 1.369
(getting it\).)-.18 F -.8(Ty)6.369 G(ping).8 E F1(popd)72 375.6 Q F0(se)
4.563 E -.15(ve)-.25 G .397(ral times in a series tak).15 F .396
(es you backw)-.1 F .396
(ard through the directories you had been in \(changed to\) by)-.1 F F1
(pushd)72 387.6 Q F0 3.288(command. There)4.954 F .788
(are other options to)3.288 F F1(pushd)3.288 E F0(and)4.954 E F1(popd)
3.288 E F0 .789(to manipulate the contents of the directory)4.954 F(sta\
ck and to change to directories not at the top of the stack; see the)72
399.6 Q F1(csh)2.5 E F0(manual page for details.)4.166 E .86
(Since the shell remembers the w)97 415.2 R .86
(orking directory in which each job w)-.1 F .86(as started, it w)-.1 F
86(arns you when)-.1 F .789
(you might be confused by restarting a job in the fore)72 427.2 R .789
(ground which has a dif)-.15 F .789(ferent w)-.25 F .789
(orking directory than)-.1 F .019(the current w)72 439.2 R .019
(orking directory of the shell.)-.1 F .018
(Thus if you start a background job, then change the shell')5.018 F
2.518(sw)-.55 G(ork-)-2.618 E .04
(ing directory and then cause the background job to run in the fore)72
451.2 R .04(ground, the shell w)-.15 F .04(arns you that the w)-.1 F
(ork-)-.1 E(ing directory of the currently running fore)72 463.2 Q
(ground job is dif)-.15 E(ferent from that of the shell.)-.25 E 2.5(%d)
108 481.2 S(irs \255l)-2.5 E(/mnt/bill)108 493.2 Q 2.5(%c)108 505.2 S
2.5(dm)-2.5 G(yproject)-2.5 E 2.5(%d)108 517.2 S(irs)-2.5 E(~/myproject)
108 529.2 Q 2.5(%e)108 541.2 S 2.5(dp)-2.5 G(rog.c)-2.5 E(1143)108 553.2
Q(^Z)108 565.2 Q(Stopped)108 577.2 Q 2.5(%c)108 589.2 S 2.5(d.)-2.5 G(.)
-2.5 E 2.5(%l)108 601.2 S(s)-2.5 E(myproject)108 613.2 Q(te)108 625.2 Q
(xt\214le)-.15 E 2.5(%f)108 637.2 S(g)-2.5 E
(ed prog.c \(wd: ~/myproject\))108 649.2 Q 1.163(This w)72 667.2 R 1.163
(ay the shell w)-.1 F 1.162
(arns you when there is an implied change of w)-.1 F 1.162
(orking directory)-.1 F 3.662(,e)-.65 G -.15(ve)-3.912 G 3.662(nt).15 G
1.162(hough no cd)-3.662 F 1.235(command w)72 679.2 R 1.235(as issued.)
-.1 F 1.235(In the abo)6.235 F 1.535 -.15(ve ex)-.15 H 1.235
(ample the `ed' job w).15 F 1.235(as still in `/mnt/bill/project' e)-.1
F -.15(ve)-.25 G 3.735(nt).15 G 1.235(hough the)-3.735 F .862
(shell had changed to `/mnt/bill'.)72 691.2 R 3.361(As)5.861 G .861
(imilar w)-3.361 F .861(arning is gi)-.1 F -.15(ve)-.25 G 3.361(nw).15 G
861(hen such a fore)-3.361 F .861(ground job terminates or is)-.15 F
(suspended \(using the)72 703.2 Q/F2 8/Times-Roman@0 SF(ST)2.5 E(OP)
-.144 E F0(signal\) since the return to the shell ag)2.5 E
(ain implies a change of w)-.05 E(orking directory)-.1 E(.)-.65 E EP
%%Page: 22 22
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-22 An)72 52 R
(Introduction to the C shell)2.5 E 2.5(%f)108 90 S(g)-2.5 E
(ed prog.c \(wd: ~/myproject\))108 102 Q 2.5(...a)110.5 114 S
(fter some editing)-2.5 E(q)108 126 Q(\(wd no)108 138 Q(w: ~\))-.25 E(%)
108 150 Q .868(These messages are sometimes confusing if you use progra\
ms that change their o)72 168 R .868(wn w)-.25 F .868
(orking directories,)-.1 F 1.267(since the shell only remembers which d\
irectory a job is started in, and assumes it stays there.)72 180 R 1.267
(The `\255l')6.267 F .778(option of)72 192 R/F1 10/Times-Italic@0 SF
(jobs)3.278 E F0 .778(will type the w)4.944 F .779
(orking directory of suspended or background jobs when it is dif)-.1 F
779(ferent from)-.25 F(the current w)72 204 Q
(orking directory of the shell.)-.1 E/F2 10/Times-Bold@0 SF 2.5
(2.8. Useful)72 228 R -.2(bu)2.5 G(ilt-in commands).2 E F0 1.6 -.8(We n)
97 243.6 T .5 -.25(ow g).8 H -2.15 -.25(iv e).25 H 2.5(af)2.75 G .5 -.25
(ew o)-2.5 H 2.5(ft).25 G(he useful b)-2.5 E
(uilt-in commands of the shell describing ho)-.2 E 2.5(wt)-.25 G(he)-2.5
E 2.5(ya)-.15 G(re used.)-2.5 E(The)97 259.2 Q F1(alias)3.261 E F0 .761
(command described abo)4.927 F 1.06 -.15(ve i)-.15 H 3.26(su).15 G .76
(sed to assign ne)-3.26 F 3.26(wa)-.25 G .76(liases and to sho)-3.26 F
3.26(wt)-.25 G .76(he e)-3.26 F .76(xisting aliases.)-.15 F -.4(Wi)72
271.2 S(th no ar).4 E(guments it prints the current aliases.)-.18 E
(It may also be gi)5 E -.15(ve)-.25 G 2.5(no).15 G(nly one ar)-2.5 E
(gument such as)-.18 E(alias ls)108 289.2 Q(to sho)72 307.2 Q 2.5(wt)
-.25 G(he current alias for)-2.5 E 2.5(,e)-.4 G(.g., `ls'.)-2.5 E(The)97
322.8 Q F1(ec)3.398 E(ho)-.15 E F0 .898(command prints its ar)5.064 F
3.399(guments. It)-.18 F .899(is often used in)3.399 F F1 .899
(shell scripts)3.399 F F0 .899(or as an interacti)5.065 F 1.199 -.15
(ve c)-.25 H(om-).15 E(mand to see what \214lename e)72 334.8 Q
(xpansions will produce.)-.15 E(The)97 350.4 Q F1(history)2.841 E F0
341(command will sho)4.507 F 2.84(wt)-.25 G .34
(he contents of the history list.)-2.84 F .34(The numbers gi)5.34 F -.15
(ve)-.25 G 2.84(nw).15 G .34(ith the history)-2.84 F -2.15 -.25(ev e)72
362.4 T .188(nts can be used to reference pre).25 F .189(vious e)-.25 F
-.15(ve)-.25 G .189(nts which are dif).15 F .189
(\214cult to reference using the conte)-.25 F .189(xtual mecha-)-.15 F
201(nisms introduced abo)72 374.4 R -.15(ve)-.15 G 5.201(.T).15 G .201
(here is also a shell v)-5.201 F .201(ariable called)-.25 F F1(pr)2.701
E(ompt.)-.45 E F0 .2(By placing a `!' character in its v)4.367 F(alue)
-.25 E .238(the shell will there substitute the number of the current c\
ommand in the history list.)72 386.4 R -1.1(Yo)5.238 G 2.738(uc)1.1 G
238(an use this num-)-2.738 F
(ber to refer to this command in a history substitution.)72 398.4 Q
(Thus you could)5 E(set prompt=\264\\! % \264)108 416.4 Q
(Note that the `!' character had to be)72 434.4 Q F1(escaped)2.5 E F0
(here e)4.166 E -.15(ve)-.25 G 2.5(nw).15 G(ithin `\264' characters.)
-2.5 E(The)97 450 Q F1(limit)2.802 E F0 .302
(command is used to restrict use of resources.)4.468 F -.4(Wi)5.301 G
301(th no ar).4 F .301(guments it prints the current limi-)-.18 F
(tations:)72 462 Q 37.28(cputime unlimited)108 480 R 41.17
(\214lesize unlimited)108 492 R 37.29(datasize 5616)108 504 R(kbytes)2.5
E 33.4(stacksize 512)108 516 R(kbytes)2.5 E 13.96
(coredumpsize unlimited)108 528 R(Limits can be set, e.g.:)72 546 Q
(limit coredumpsize 128k)108 564 Q(Most reasonable units abbre)72 582 Q
(viations will w)-.25 E(ork; see the)-.1 E F1(csh)2.5 E F0
(manual page for more details.)4.166 E(The)97 597.6 Q F1(lo)2.5 E(gout)
-.1 E F0(command can be used to terminate a login shell which has)4.166
E F1(ignor)2.5 E(eeof)-.37 E F0(set.)4.166 E(The)97 613.2 Q F1 -.37(re)
2.861 G(hash).37 E F0 .361(command causes the shell to recompute a tabl\
e of where commands are located.)4.527 F .362(This is)5.362 F .019
(necessary if you add a command to a directory in the current shell')72
625.2 R 2.519(ss)-.55 G .019
(earch path and wish the shell to \214nd it,)-2.519 F .055(since otherw\
ise the hashing algorithm may tell the shell that the command w)72 637.2
R(asn')-.1 E 2.556(ti)-.18 G 2.556(nt)-2.556 G .056
(hat directory when the)-2.556 F(hash table w)72 649.2 Q(as computed.)
-.1 E(The)97 664.8 Q F1 -.37(re)2.911 G(peat).37 E F0 .411
(command can be used to repeat a command se)4.577 F -.15(ve)-.25 G .411
(ral times.).15 F .411(Thus to mak)5.411 F 2.91(e5c)-.1 G .41
(opies of the)-2.91 F(\214le)72 676.8 Q F1(one)2.5 E F0(in the \214le)
4.166 E F1(\214ve)2.5 E F0(you could do)4.166 E
(repeat 5 cat one >> \214v)108 694.8 Q(e)-.15 E(The)97 716.4 Q F1(seten)
2.5 E(v)-.4 E F0(command can be used to set v)4.166 E
(ariables in the en)-.25 E 2.5(vironment. Thus)-.4 F EP
%%Page: 23 23
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-23)271.17 E(seten)108 90 Q
2.5(vT)-.4 G(ERM adm3a)-2.5 E .19(will set the v)72 108 R .19
(alue of the en)-.25 F .19(vironment v)-.4 F(ariable)-.25 E/F1 8
/Times-Roman@0 SF(TERM)2.69 E F0 .19(to `adm3a'.)2.69 F 2.69(Au)5.19 G
19(ser program)-2.69 F/F2 10/Times-Italic@0 SF(printen)2.69 E(v)-.4 E
F0 -.15(ex)4.356 G .19(ists which will).15 F(print out the en)72 120 Q
2.5(vironment. It)-.4 F(might then sho)2.5 E(w:)-.25 E 2.5(%p)108 138 S
(rinten)-2.5 E(v)-.4 E(HOME=/usr/bill)108 150 Q(SHELL=/bin/csh)108 162 Q
-.92(PA)108 174 S(TH=:/usr/ucb:/bin:/usr/bin:/usr/local)-.19 E
(TERM=adm3a)108 186 Q(USER=bill)108 198 Q(%)108 210 Q(The)97 231.6 Q F2
(sour)2.5 E(ce)-.37 E F0(command can be used to force the current shell\
to read commands from a \214le.)4.166 E(Thus)5 E(source .cshrc)108
249.6 Q(can be used after editing in a change to the)72 267.6 Q F2
(.cshr)2.5 E(c)-.37 E F0(\214le which you wish to tak)4.166 E 2.5(ee)-.1
G -.25(ff)-2.5 G(ect right a).25 E -.1(wa)-.15 G -.65(y.).1 G(The)97
283.2 Q F2(time)3.367 E F0 .867
(command can be used to cause a command to be timed no matter ho)5.033 F
3.366(wm)-.25 G(uch)-3.366 E F1(CPU)3.366 E F0 .866(time it)3.366 F(tak)
72 295.2 Q 2.5(es. Thus)-.1 F 2.5(%t)108 313.2 S
(ime cp /etc/rc /usr/bill/rc)-2.5 E(0.0u 0.1s 0:01 8% 2+1k 3+2io 1pf+0w)
108 325.2 Q 2.5(%t)108 337.2 S(ime wc /etc/rc /usr/bill/rc)-2.5 E 7.5
(52 178)120.5 349.2 R(1347 /etc/rc)7.5 E 7.5(52 178)120.5 361.2 R
(1347 /usr/bill/rc)7.5 E 7.5(104 356)118 373.2 R(2694 total)7.5 E
(0.1u 0.1s 0:00 13% 3+3k 5+3io 7pf+0w)108 385.2 Q(%)108 397.2 Q .188
(indicates that the)72 415.2 R F2(cp)2.688 E F0 .188(command used a ne)
4.354 F .189
(gligible amount of user time \(u\) and about 1/10th of a system time)
-.15 F .024(\(s\); the elapsed time w)72 427.2 R .023
(as 1 second \(0:01\), there w)-.1 F .023(as an a)-.1 F -.15(ve)-.2 G
023(rage memory usage of 2k bytes of program space).15 F .018
(and 1k bytes of data space o)72 439.2 R -.15(ve)-.15 G 2.518(rt).15 G
018(he cpu time in)-2.518 F -.2(vo)-.4 G(lv).2 E .018
(ed \(2+1k\); the program did three disk reads and tw)-.15 F 2.518(od)
-.1 G(isk)-2.518 E .463(writes \(3+2io\), and took one page f)72 451.2 R
463(ault and w)-.1 F .463(as not sw)-.1 F .462(apped \(1pf+0w\).)-.1 F
462(The w)5.462 F .462(ord count command)-.1 F F2(wc)2.962 E F0(on)
4.628 E 1.575(the other hand used 0.1 seconds of user time and 0.1 seco\
nds of system time in less than a second of)72 463.2 R .842
(elapsed time.)72 475.2 R .841(The percentage `13%' indicates that o)
5.842 F -.15(ve)-.15 G 3.341(rt).15 G .841(he period when it w)-3.341 F
841(as acti)-.1 F 1.141 -.15(ve t)-.25 H .841(he command `wc').15 F
(used an a)72 487.2 Q -.15(ve)-.2 G(rage of 13 percent of the a).15 E
-.25(va)-.2 G(ilable).25 E F1(CPU)2.5 E F0 -.15(cy)2.5 G
(cles of the machine.).15 E(The)97 502.8 Q F2(unalias)3.581 E F0(and)
5.247 E F2(unset)3.581 E F0 1.081(commands can be used to remo)5.247 F
1.381 -.15(ve a)-.15 H 1.081(liases and v).15 F 1.082
(ariable de\214nitions from the)-.25 F(shell, and)72 514.8 Q F2(unseten)
2.5 E(v)-.4 E F0(remo)4.166 E -.15(ve)-.15 G 2.5(sv).15 G
(ariables from the en)-2.75 E(vironment.)-.4 E/F3 10/Times-Bold@0 SF 2.5
(2.9. What)72 538.8 R(else?)2.5 E F0 1.033
(This concludes the basic discussion of the shell for terminal users.)97
554.4 R 1.033(There are more features of the)6.033 F .051(shell to be d\
iscussed here, and all features of the shell are discussed in its manua\
l pages.)72 566.4 R .052(One useful feature)5.052 F 1.389
(which is discussed later is the)72 578.4 R F2(for)3.889 E(eac)-.37 E(h)
-.15 E F0 -.2(bu)5.555 G 1.388
(ilt-in command which can be used to run the same command).2 F
(sequence with a number of dif)72 590.4 Q(ferent ar)-.25 E(guments.)-.18
E .99(If you intend to use)97 606 R F1(UNIX)3.49 E F0 3.49(al)3.49 G
991
(ot you you should look through the rest of this document and the csh)
-3.49 F(manual pages \(section1\) to become f)72 618 Q
(amiliar with the other f)-.1 E(acilities which are a)-.1 E -.25(va)-.2
G(ilable to you.).25 E EP
%%Page: 24 24
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-24 An)72 52 R
(Introduction to the C shell)2.5 E/F1 10/Times-Bold@0 SF 2.5(3. Shell)72
84 R(contr)2.5 E(ol structur)-.18 E(es and command scripts)-.18 E 2.5
(3.1. Intr)72 108 R(oduction)-.18 E F0 .585(It is possible to place com\
mands in \214les and to cause shells to be in)97 123.6 R -.2(vo)-.4 G
-.1(ke).2 G 3.084(dt).1 G 3.084(or)-3.084 G .584(ead and e)-3.084 F -.15
(xe)-.15 G .584(cute com-).15 F .808
(mands from these \214les, which are called)72 135.6 R/F2 10
/Times-Italic@0 SF .808(shell scripts.)3.308 F F0 2.408 -.8(We h)4.974 H
808(ere detail those features of the shell useful to).8 F
(the writers of such scripts.)72 147.6 Q F1 2.5(3.2. Mak)72 171.6 R(e)
-.1 E F0 1.293(It is important to \214rst note what shell scripts are)97
187.2 R F2(not)3.793 E F0 1.293(useful for)5.459 F 6.292(.T)-.55 G 1.292
(here is a program called)-6.292 F F2(mak)3.792 E(e)-.1 E F0 1.258
(which is v)72 199.2 R 1.258(ery useful for maintaining a group of rela\
ted \214les or performing sets of operations on related)-.15 F 2.808
(\214les. F)72 211.2 R .308(or instance a lar)-.15 F .308
(ge program consisting of one or more \214les can ha)-.18 F .608 -.15
(ve i)-.2 H .307(ts dependencies described in a).15 F F2(mak)72 223.2 Q
(e\214le)-.1 E F0 1.642
(which contains de\214nitions of the commands used to create these dif)
5.807 F 1.642(ferent \214les when changes)-.25 F(occur)72 235.2 Q 5.202
(.D)-.55 G .202(e\214nitions of the means for printing listings, cleani\
ng up the directory in which the \214les reside, and)-5.202 F .771
(installing the resultant programs are easily)72 247.2 R 3.271(,a)-.65 G
771(nd most appropriately placed in this)-3.271 F F2(mak)3.271 E
(e\214le)-.1 E(.)-.15 E F0 .771(This format is)4.937 F(superior and pre\
ferable to maintaining a group of shell procedures to maintain these \
\214les.)72 259.2 Q .599(Similarly when w)97 274.8 R .599
(orking on a document a)-.1 F F2(mak)3.098 E(e\214le)-.1 E F0 .598
(may be created which de\214nes ho)4.764 F 3.098(wd)-.25 G(if)-3.098 E
598(ferent v)-.25 F(er)-.15 E(-)-.2 E
(sions of the document are to be created and which options of)72 286.8 Q
F2(nr)2.5 E(of)-.45 E(f)-.18 E F0(or)4.166 E F2(tr)2.5 E(of)-.45 E(f)
-.18 E F0(are appropriate.)4.166 E F1 2.5(3.3. In)72 310.8 R -.1(vo)-.4
G(cation and the ar).1 E(gv v)-.1 E(ariable)-.1 E F0(A)97 326.4 Q F2
(csh)2.5 E F0(command script may be interpreted by saying)4.166 E 2.5
(%c)108 344.4 S(sh script ...)-2.5 E(where)72 362.4 Q F2(script)2.653 E
F0 .153(is the name of the \214le containing a group of)4.319 F F2(csh)
2.653 E F0 .154(commands and `...)4.32 F 2.654('i)-.7 G 2.654(sr)-2.654
G .154(eplaced by a sequence)-2.654 F 1.138(of ar)72 374.4 R 3.638
(guments. The)-.18 F 1.138(shell places these ar)3.638 F 1.138
(guments in the v)-.18 F(ariable)-.25 E F2(ar)3.638 E(gv)-.37 E F0 1.138
(and then be)5.304 F 1.137(gins to read commands)-.15 F .138
(from the script.)72 386.4 R .138(These parameters are then a)5.138 F
-.25(va)-.2 G .138
(ilable through the same mechanisms which are used to refer).25 F(-)-.2
E(ence an)72 398.4 Q 2.5(yo)-.15 G(ther shell v)-2.5 E(ariables.)-.25 E
(If you mak)97 414 Q 2.5(et)-.1 G(he \214le `script' e)-2.5 E -.15(xe)
-.15 G(cutable by doing).15 E(chmod 755 script)108 432 Q .207
(and place a shell comment at the be)72 450 R .206
(ginning of the shell script \(i.e. be)-.15 F .206
(gin the \214le with a `#' character\) then a)-.15 F
(`/bin/csh' will automatically be in)72 462 Q -.2(vo)-.4 G -.1(ke).2 G
2.5(dt).1 G 2.5(oe)-2.5 G -.15(xe)-2.65 G(cute `script' when you type)
15 E(script)108 480 Q .434(If the \214le does not be)72 498 R .435
(gin with a `#' then the standard shell `/bin/sh' will be used to e)-.15
F -.15(xe)-.15 G .435(cute it.).15 F .435(This allo)5.435 F(ws)-.25 E
(you to con)72 510 Q -.15(ve)-.4 G(rt your older shell scripts to use)
15 E F2(csh)2.5 E F0(at your con)4.166 E -.15(ve)-.4 G(nience.).15 E F1
2.5(3.4. V)72 534 R(ariable substitution)-.92 E F0 .88
(After each input line is brok)97 549.6 R .88(en into w)-.1 F .879
(ords and history substitutions are done on it, the input line is)-.1 F
186(parsed into distinct commands.)72 561.6 R .186
(Before each command is e)5.186 F -.15(xe)-.15 G .187
(cuted a mechanism kno).15 F 2.687(wa)-.25 G(s)-2.687 E F2 .187
(variable substitu-)2.687 F(tion)72 573.6 Q F0 .096(is done on these w)
4.262 F 2.595(ords. K)-.1 F -.15(ey)-.25 G .095
(ed by the character `$' this substitution replaces the names of v).15 F
095(ariables by)-.25 F(their v)72 585.6 Q 2.5(alues. Thus)-.25 F
(echo $ar)108 603.6 Q(gv)-.18 E .848(when placed in a command script w)
72 621.6 R .849(ould cause the current v)-.1 F .849(alue of the v)-.25 F
(ariable)-.25 E F2(ar)3.349 E(gv)-.37 E F0 .849(to be echoed to the)
5.015 F(output of the shell script.)72 633.6 Q(It is an error for)5 E F2
(ar)2.5 E(gv)-.37 E F0(to be unset at this point.)4.166 E 2.97(An)97
649.2 S .47(umber of notations are pro)-2.97 F .469
(vided for accessing components and attrib)-.15 F .469(utes of v)-.2 F
2.969(ariables. The)-.25 F(nota-)2.969 E(tion)72 661.2 Q($?name)108
679.2 Q -.15(ex)72 697.2 S .037(pands to `1' if name is).15 F F2(set)
2.537 E F0 .038(or to `0' if name is not)4.203 F F2(set.)2.538 E F0 .038
(It is the fundamental mechanism used for checking)4.204 F .23
(whether particular v)72 709.2 R .23(ariables ha)-.25 F .53 -.15(ve b)
-.2 H .23(een assigned v).15 F 2.73(alues. All)-.25 F .23
(other forms of reference to unde\214ned v)2.73 F(ariables)-.25 E
(cause errors.)72 721.2 Q EP
%%Page: 25 25
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-25)271.17 E(The notation)
97 84 Q($#name)108 102 Q -.15(ex)72 120 S
(pands to the number of elements in the v).15 E(ariable)-.25 E/F1 10
/Times-Italic@0 SF(name)2.5 E(.)-.15 E F0(Thus)4.166 E 2.5(%s)108 138 S
(et ar)-2.5 E(gv=\(a b c\))-.18 E 2.5(%e)108 150 S(cho $?ar)-2.5 E(gv)
-.18 E(1)108 162 Q 2.5(%e)108 174 S(cho $#ar)-2.5 E(gv)-.18 E(3)108 186
Q 2.5(%u)108 198 S(nset ar)-2.5 E(gv)-.18 E 2.5(%e)108 210 S(cho $?ar)
-2.5 E(gv)-.18 E(0)108 222 Q 2.5(%e)108 234 S(cho $ar)-2.5 E(gv)-.18 E
(Unde\214ned v)108 246 Q(ariable: ar)-.25 E(gv)-.18 E(.)-.65 E(%)108 258
Q(It is also possible to access the components of a v)97 279.6 Q
(ariable which has se)-.25 E -.15(ve)-.25 G(ral v).15 E 2.5(alues. Thus)
-.25 F($ar)108 297.6 Q(gv[1])-.18 E(gi)72 315.6 Q -.15(ve)-.25 G 2.5(st)
15 G(he \214rst component of)-2.5 E F1(ar)2.5 E(gv)-.37 E F0
(or in the e)4.166 E(xample abo)-.15 E .3 -.15(ve `)-.15 H 2.5
(a'. Similarly).15 F($ar)108 333.6 Q(gv[$#ar)-.18 E(gv])-.18 E -.1(wo)72
351.6 S(uld gi).1 E .3 -.15(ve `)-.25 H(c', and).15 E($ar)108 369.6 Q
(gv[1\2552])-.18 E -.1(wo)72 387.6 S(uld gi).1 E .3 -.15(ve `)-.25 H 2.5
(ab).15 G('. Other notations useful in shell scripts are)-2.5 E($)108
405.6 Q F1(n)A F0(where)72 423.6 Q F1(n)2.5 E F0(is an inte)4.166 E
(ger as a shorthand for)-.15 E($ar)108 441.6 Q(gv[)-.18 E F1(n)A F0(])
1.666 E(the)72 459.6 Q F1 1.666(nt)2.5 G(h)-1.666 E F0(parameter and)
4.166 E($*)108 477.6 Q(which is a shorthand for)72 495.6 Q($ar)108 513.6
Q(gv)-.18 E(The form)72 531.6 Q($$)108 549.6 Q -.15(ex)72 567.6 S .013
(pands to the process number of the current shell.).15 F .014
(Since this process number is unique in the system it can)5.014 F
(be used in generation of unique temporary \214le names.)72 579.6 Q
(The form)5 E($<)108 597.6 Q .092
(is quite special and is replaced by the ne)72 615.6 R .091
(xt line of input read from the shell')-.15 F 2.591(ss)-.55 G .091
(tandard input \(not the script it)-2.591 F .015(is reading\).)72 627.6
R .015(This is useful for writing shell scripts that are interacti)5.015
F -.15(ve)-.25 G 2.515(,r).15 G .015(eading commands from the terminal,)
-2.515 F(or e)72 639.6 Q -.15(ve)-.25 G 2.5(nw).15 G
(riting a shell script that acts as a \214lter)-2.5 E 2.5(,r)-.4 G
(eading lines from its input \214le. Thus the sequence)-2.5 E
(echo 'yes or no?\\c')108 657.6 Q(set a=\($<\))108 669.6 Q -.1(wo)72
687.6 S .697(uld write out the prompt `yes or no?' without a ne).1 F
697(wline and then read the answer into the v)-.25 F .696(ariable `a'.)
-.25 F(In this case `$#a' w)72 699.6 Q
(ould be `0' if either a blank line or end-of-\214le \(^D\) w)-.1 E
(as typed.)-.1 E .631(One minor dif)97 715.2 R .631(ference between `$)
-.25 F F1(n)A F0 3.131('a)1.666 G .631(nd `$ar)-3.131 F(gv[)-.18 E F1(n)
A F0 .632(]' should be noted here.)1.666 F .632(The form `$ar)5.632 F
(gv[)-.18 E F1(n)A F0 .632(]' will)1.666 F .229(yield an error if)72
727.2 R F1(n)2.729 E F0 .229(is not in the range `1\255$#ar)4.395 F .229
(gv' while `$n' will ne)-.18 F -.15(ve)-.25 G 2.729(ry).15 G .228
(ield an out of range subscript error)-2.729 F(.)-.55 E EP
%%Page: 26 26
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-26 An)72 52 R
(Introduction to the C shell)2.5 E(This is for compatibility with the w)
72 84 Q(ay older shells handled parameters.)-.1 E .834
(Another important point is that it is ne)97 99.6 R -.15(ve)-.25 G 3.334
(ra).15 G 3.334(ne)-3.334 G .834(rror to gi)-3.334 F 1.134 -.15(ve a s)
-.25 H .834(ubrange of the form `n\255'; if there are).15 F 1.047
(less than)72 111.6 R/F1 10/Times-Italic@0 SF(n)3.547 E F0 1.047
(components of the gi)5.213 F -.15(ve)-.25 G 3.547(nv).15 G 1.047
(ariable then no w)-3.797 F 1.047(ords are substituted.)-.1 F 3.547(Ar)
6.047 G 1.047(ange of the form `m\255n')-3.547 F(lik)72 123.6 Q -.25(ew)
-.1 G 1.008(ise returns an empty v).25 F 1.009(ector without gi)-.15 F
1.009(ving an error when)-.25 F F1(m)3.509 E F0 -.15(ex)3.509 G 1.009
(ceeds the number of elements of the).15 F(gi)72 135.6 Q -.15(ve)-.25 G
2.5(nv).15 G(ariable, pro)-2.75 E(vided the subscript)-.15 E F1(n)2.5 E
F0(is in range.)2.5 E/F2 10/Times-Bold@0 SF 2.5(3.5. Expr)72 159.6 R
(essions)-.18 E F0 .828(In order for interesting shell scripts to be co\
nstructed it must be possible to e)97 175.2 R -.25(va)-.25 G .828
(luate e).25 F .828(xpressions in)-.15 F .311(the shell based on the v)
72 187.2 R .311(alues of v)-.25 F 2.811(ariables. In)-.25 F -.1(fa)2.812
G .312(ct, all the arithmetic operations of the language C are a).1 F
-.25(va)-.2 G(il-).25 E .671
(able in the shell with the same precedence that the)72 199.2 R 3.171
(yh)-.15 G -2.25 -.2(av e)-3.171 H .67(in C.)3.37 F .67(In particular)
5.67 F 3.17(,t)-.4 G .67(he operations `==' and `!=')-3.17 F 1.37
(compare strings and the operators `&&' and `|)72 211.2 R 1.371
(|' implement the boolean and/or operations.)3.332 F 1.371(The special)
6.371 F .614(operators `=~' and `!~' are similar to `==' and `!=' e)72
223.2 R .613(xcept that the string on the right side can ha)-.15 F .913
-.15(ve p)-.2 H(attern).15 E .395(matching characters \(lik)72 235.2 R
2.895(e*)-.1 G 2.895(,?o)-2.895 G 2.895(r[)-2.895 G .395(]\) and the te\
st is whether the string on the left matches the pattern on the)-2.895 F
(right.)72 247.2 Q(The shell also allo)97 262.8 Q
(ws \214le enquiries of the form)-.25 E(\255? \214lename)108 280.8 Q
(where `?' is replace by a number of single characters.)72 298.8 Q -.15
(Fo)5 G 2.5(ri).15 G(nstance the e)-2.5 E(xpression primiti)-.15 E -.15
(ve)-.25 G(\255e \214lename)108 316.8 Q .973
(tell whether the \214le `\214lename' e)72 334.8 R 3.473(xists. Other)
-.15 F(primiti)3.473 E -.15(ve)-.25 G 3.473(st).15 G .973
(est for read, write and e)-3.473 F -.15(xe)-.15 G .973
(cute access to the \214le,).15 F(whether it is a directory)72 346.8 Q
2.5(,o)-.65 G 2.5(rh)-2.5 G(as non-zero length.)-2.5 E .193
(It is possible to test whether a command terminates normally)97 362.4 R
2.694(,b)-.65 G 2.694(yap)-2.694 G(rimiti)-2.694 E .494 -.15(ve o)-.25 H
2.694(ft).15 G .194(he form `{ command)-2.694 F .045
(}' which returns true, i.e. `1' if the command succeeds e)72 374.4 R
045(xiting normally with e)-.15 F .045
(xit status 0, or `0' if the com-)-.15 F .298
(mand terminates abnormally or with e)72 386.4 R .298
(xit status non-zero.)-.15 F .299
(If more detailed information about the e)5.299 F -.15(xe)-.15 G(cution)
15 E .889(status of a command is required, it can be e)72 398.4 R -.15
(xe)-.15 G .888(cuted and the v).15 F .888(ariable `$status' e)-.25 F
888(xamined in the ne)-.15 F .888(xt com-)-.15 F 2.911(mand. Since)72
410.4 R .411(`$status' is set by e)2.911 F -.15(ve)-.25 G .411
(ry command, it is v).15 F .411(ery transient.)-.15 F .411(It can be sa)
5.411 F -.15(ve)-.2 G 2.911(di).15 G 2.911(fi)-2.911 G 2.911(ti)-2.911 G
2.911(si)-2.911 G(ncon)-2.911 E -.15(ve)-.4 G .411(nient to).15 F
(use it only in the single immediately follo)72 422.4 Q(wing command.)
-.25 E -.15(Fo)97 438 S 2.5(raf).15 G(ull list of e)-2.5 E
(xpression components a)-.15 E -.25(va)-.2 G
(ilable see the manual section for the shell.).25 E F2 2.5(3.6. Sample)
72 462 R(shell script)2.5 E F0 2.659(As)97 477.6 S .159
(ample shell script which mak)-2.659 F .159(es use of the e)-.1 F .159
(xpression mechanism of the shell and some of its con-)-.15 F
(trol structure follo)72 489.6 Q(ws:)-.25 E EP
%%Page: 27 27
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-27)271.17 E 2.5(%c)108 90
S(at cop)-2.5 E(yc)-.1 E(#)108 102 Q 2.5(#C)108 114 S(op)-2.5 E
(yc copies those C programs in the speci\214ed list)-.1 E 2.5(#t)108 126
S 2.5(ot)-2.5 G(he directory ~/backup if the)-2.5 E 2.5(yd)-.15 G(if)
-2.5 E(fer from the \214les)-.25 E 2.5(#a)108 138 S(lready in ~/backup)
-2.5 E(#)108 150 Q(set noglob)108 162 Q(foreach i \($ar)108 174 Q(gv\))
-.18 E(if \($i !~ *.c\) continue)128 198 Q 2.5(#n)5 G
(ot a .c \214le so do nothing)-2.5 E(if \(! \255r ~/backup/$i:t\) then)
128 222 Q(echo $i:t not in backup... not cp\\\264ed)148 234 Q(continue)
148 246 Q(endif)128 258 Q(cmp \255s $i ~/backup/$i:t # to set $status)
128 282 Q(if \($status != 0\) then)128 306 Q(echo ne)148 318 Q 2.5(wb)
-.25 G(ackup of $i)-2.5 E(cp $i ~/backup/$i:t)148 330 Q(endif)128 342 Q
(end)108 354 Q 1.42(This script mak)97 375.6 R 1.421(es use of the)-.1 F
/F1 10/Times-Italic@0 SF(for)3.921 E(eac)-.37 E(h)-.15 E F0 1.421
(command, which causes the shell to e)5.587 F -.15(xe)-.15 G 1.421
(cute the commands).15 F .276(between the)72 387.6 R F1(for)2.776 E(eac)
-.37 E(h)-.15 E F0 .275(and the matching)4.442 F F1(end)2.775 E F0 .275
(for each of the v)4.441 F .275(alues gi)-.25 F -.15(ve)-.25 G 2.775(nb)
15 G .275(etween `\(' and `\)' with the named)-2.775 F -.25(va)72 399.6
S 1.287(riable, in this case `i' set to successi).25 F 1.587 -.15(ve v)
-.25 H 1.287(alues in the list.)-.1 F -.4(Wi)6.287 G 1.287
(thin this loop we may use the command).4 F F1(br)72 411.6 Q(eak)-.37 E
F0 .902(to stop e)5.068 F -.15(xe)-.15 G .901(cuting the loop and).15 F
F1(continue)3.401 E F0 .901
(to prematurely terminate one iteration and be)5.067 F .901(gin the ne)
-.15 F(xt.)-.15 E(After the)72 423.6 Q F1(for)2.5 E(eac)-.37 E(h)-.15 E
F0(loop the iteration v)4.166 E(ariable \()-.25 E F1(i)A F0
(in this case\) has the v)2.5 E(alue at the last iteration.)-.25 E 2.867
-.8(We s)97 439.2 T 1.267(et the v).8 F(ariable)-.25 E F1(no)3.767 E
(glob)-.1 E F0 1.267(here to pre)5.433 F -.15(ve)-.25 G 1.267
(nt \214lename e).15 F 1.268(xpansion of the members of)-.15 F F1(ar)
3.768 E(gv)-.37 E(.)-.74 E F0 1.268(This is a)5.434 F .371
(good idea, in general, if the ar)72 451.2 R .371
(guments to a shell script are \214lenames which ha)-.18 F .67 -.15
(ve a)-.2 H .37(lready been e).15 F .37(xpanded or)-.15 F .419
(if the ar)72 463.2 R .419(guments may contain \214lename e)-.18 F .419
(xpansion metacharacters.)-.15 F .42
(It is also possible to quote each use of a)5.419 F(`$' v)72 475.2 Q
(ariable e)-.25 E(xpansion, b)-.15 E
(ut this is harder and less reliable.)-.2 E
(The other control construct used here is a statement of the form)97
490.8 Q/F2 10/Times-Bold@0 SF(if)108 508.8 Q F0 2.5(\(e)2.5 G
(xpression \))-2.65 E F2(then)2.5 E F0(command)133 520.8 Q(...)133 532.8
Q F2(endif)108 544.8 Q F0(The placement of the k)72 562.8 Q -.15(ey)-.1
G -.1(wo).15 G(rds here is).1 E F2(not)2.5 E F0<8d65>2.5 E
(xible due to the current implementation of the shell.\207)-.15 E
(The shell does ha)97 578.4 Q .3 -.15(ve a)-.2 H
(nother form of the if statement of the form).15 E .32 LW 76 598 72 598
DL 80 598 76 598 DL 84 598 80 598 DL 88 598 84 598 DL 92 598 88 598 DL
96 598 92 598 DL 100 598 96 598 DL 104 598 100 598 DL 108 598 104 598 DL
112 598 108 598 DL 116 598 112 598 DL 120 598 116 598 DL 124 598 120 598
DL 128 598 124 598 DL 132 598 128 598 DL 136 598 132 598 DL 140 598 136
598 DL 144 598 140 598 DL/F3 8/Times-Roman@0 SF(\207The follo)72 608 Q
(wing tw)-.2 E 2(of)-.08 G
(ormats are not currently acceptable to the shell:)-2 E/F4 8
/Times-Bold@0 SF(if)112 628 Q F3 2(\(e)2 G(xpression \))-2.12 E(#)57.688
E F4 -.6(Wo)2 G(n't w).6 E(ork!)-.08 E(then)112 638 Q F3(command)148 648
Q(...)148 658 Q F4(endif)112 668 Q F3(and)72 688 Q F4(if)112 708 Q F3 2
(\(e)2 G(xpression \))-2.12 E F4(then)2 E F3(command)2 E F4(endif)2 E F3
(#)59.688 E F4 -.6(Wo)2 G(n't w).6 E(ork)-.08 E EP
%%Page: 28 28
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-28 An)72 52 R
(Introduction to the C shell)2.5 E/F1 10/Times-Bold@0 SF(if)108 90 Q F0
2.5(\(e)2.5 G(xpression \))-2.65 E F1(command)2.5 E F0
(which can be written)72 108 Q F1(if)108 126 Q F0 2.5(\(e)2.5 G
(xpression \) \\)-2.65 E(command)133 138 Q .474(Here we ha)72 156 R .774
-.15(ve e)-.2 H .474(scaped the ne).15 F .473(wline for the sak)-.25 F
2.973(eo)-.1 G 2.973(fa)-2.973 G 2.973(ppearance. The)-2.973 F .473
(command must not in)2.973 F -.2(vo)-.4 G(lv).2 E 2.973(e`)-.15 G 1.666
(|')-1.307 G 2.973(,`)-1.666 G .473(&' or)-2.973 F .596
(`;' and must not be another control command.)72 168 R .596
(The second form requires the \214nal `\\' to)5.596 F F1(immediately)
3.096 E F0(pre-)3.096 E(cede the end-of-line.)72 180 Q 1.097
(The more general)97 195.6 R/F2 10/Times-Italic@0 SF(if)3.596 E F0 1.096
(statements abo)5.262 F 1.396 -.15(ve a)-.15 H 1.096
(lso admit a sequence of).15 F F2(else\255if)3.596 E F0 1.096
(pairs follo)5.262 F 1.096(wed by a single)-.25 F F2(else)72 207.6 Q F0
(and an)4.166 E F2(endif)2.5 E(,)-.1 E F0(e.g.:)4.166 E F1(if)108 225.6
Q F0 2.5(\(e)2.5 G(xpression \))-2.65 E F1(then)2.5 E F0(commands)133
237.6 Q F1(else if)108 249.6 Q F0(\(e)2.5 E(xpression \))-.15 E F1(then)
2.5 E F0(commands)133 261.6 Q(...)108 273.6 Q F1(else)108 297.6 Q F0
(commands)133 309.6 Q F1(endif)108 321.6 Q F0 .802(Another important me\
chanism used in shell scripts is the `:' modi\214er)97 343.2 R 5.803(.W)
-.55 G 3.303(ec)-6.603 G .803(an use the modi\214er `:r')-3.303 F 1.286
(here to e)72 355.2 R 1.285(xtract a root of a \214lename or `:e' to e)
-.15 F 1.285(xtract the)-.15 F F2 -.2(ex)3.785 G(tension.).2 E F0 1.285
(Thus if the v)5.451 F(ariable)-.25 E F2(i)3.785 E F0 1.285(has the v)
5.451 F(alue)-.25 E(`/mnt/foo.bar' then)72 367.2 Q 2.5(%e)122 391.2 S
(cho $i $i:r $i:e)-2.5 E(/mnt/foo.bar /mnt/foo bar)122 403.2 Q(%)122
415.2 Q(sho)72 439.2 Q 1.503(ws ho)-.25 F 4.003(wt)-.25 G 1.503
(he `:r' modi\214er strips of)-4.003 F 4.003(ft)-.25 G 1.503
(he trailing `.bar' and the the `:e' modi\214er lea)-4.003 F -.15(ve)-.2
G 4.004(so).15 G 1.504(nly the `bar'.)-4.004 F .169
(Other modi\214ers will tak)72 451.2 R 2.669(eo)-.1 G .669 -.25(ff t)
-2.669 H .169(he last component of a pathname lea).25 F .168
(ving the head `:h' or all b)-.2 F .168(ut the last com-)-.2 F .589
(ponent of a pathname lea)72 463.2 R .589(ving the tail `:t'.)-.2 F .589
(These modi\214ers are fully described in the)5.589 F F2(csh)3.089 E F0
59(manual pages in)4.755 F .452(the User')72 475.2 R 2.952(sR)-.55 G
452(eference Manual.)-2.952 F .452(It is also possible to use the)5.452
F F2 .451(command substitution)2.951 F F0 .451(mechanism described in)
4.617 F .968(the ne)72 487.2 R .969(xt major section to perform modi\
\214cations on strings to then reenter the shell')-.15 F 3.469(se)-.55 G
-.4(nv)-3.469 G 3.469(ironment. Since).4 F .162
(each usage of this mechanism in)72 499.2 R -.2(vo)-.4 G(lv).2 E .162
(es the creation of a ne)-.15 F 2.662(wp)-.25 G .161
(rocess, it is much more e)-2.662 F(xpensi)-.15 E .461 -.15(ve t)-.25 H
2.661(ou).15 G .161(se than)-2.661 F .988
(the `:' modi\214cation mechanism.\210 Finally)72 511.2 R 3.488(,w)-.65
G 3.487(en)-3.488 G .987(ote that the character `#' le)-3.487 F .987
(xically introduces a shell com-)-.15 F .397(ment in shell scripts \(b)
72 523.2 R .397(ut not from the terminal\).)-.2 F .398
(All subsequent characters on the input line after a `#' are)5.397 F
(discarded by the shell.)72 535.2 Q
(This character can be quoted using `\264' or `\\' to place it in an ar)
5 E(gument w)-.18 E(ord.)-.1 E F1 2.5(3.7. Other)72 559.2 R(contr)2.5 E
(ol structur)-.18 E(es)-.18 E F0(The shell also has control structures)
97 574.8 Q F2(while)2.5 E F0(and)4.166 E F2(switc)2.5 E(h)-.15 E F0
(similar to those of C.)4.166 E(These tak)5 E 2.5(et)-.1 G(he forms)-2.5
E F1(while)108 592.8 Q F0 2.5(\(e)2.5 G(xpression \))-2.65 E(commands)
133 604.8 Q F1(end)108 616.8 Q .32 LW 76 628 72 628 DL 80 628 76 628 DL
84 628 80 628 DL 88 628 84 628 DL 92 628 88 628 DL 96 628 92 628 DL 100
628 96 628 DL 104 628 100 628 DL 108 628 104 628 DL 112 628 108 628 DL
116 628 112 628 DL 120 628 116 628 DL 124 628 120 628 DL 128 628 124 628
DL 132 628 128 628 DL 136 628 132 628 DL 140 628 136 628 DL 144 628 140
628 DL/F3 8/Times-Roman@0 SF 2.01<8849>72 638 S 2.01(ti)-2.01 G 2.01(sa)
-2.01 G .01(lso important to note that the current implementation of th\
e shell limits the number of `:' modi\214ers on a `$' substitu-)-2.01 F
(tion to 1.)72 648 Q(Thus)4 E 2(%e)112 668 S(cho $i $i:h:t)-2 E
(/a/b/c /a/b:t)112 678 Q(%)112 688 Q(does not do what one w)72 708 Q
(ould e)-.08 E(xpect.)-.12 E EP
%%Page: 29 29
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-29)271.17 E(and)72 84 Q/F1
10/Times-Bold@0 SF(switch)108 102 Q F0 2.5(\(w)2.5 G(ord \))-2.6 E F1
(case)108 126 Q F0(str1:)2.5 E(commands)133 138 Q F1(br)133 150 Q(eaksw)
-.18 E F0(...)110.5 174 Q F1(case)108 198 Q F0(strn:)2.5 E(commands)133
210 Q F1(br)133 222 Q(eaksw)-.18 E(default:)108 246 Q F0(commands)133
258 Q F1(br)133 270 Q(eaksw)-.18 E(endsw)108 294 Q F0 -.15(Fo)72 312 S
2.907(rd).15 G .407(etails see the manual section for)-2.907 F/F2 10
/Times-Italic@0 SF(csh.)2.907 E F0 2.907(Cp)4.573 G .407
(rogrammers should note that we use)-2.907 F F2(br)2.906 E(eaksw)-.37 E
F0 .406(to e)4.572 F .406(xit from a)-.15 F F2(switc)72 324 Q(h)-.15 E
F0(while)5.354 E F2(br)3.688 E(eak)-.37 E F0 -.15(ex)5.354 G 1.188
(its a).15 F F2(while)3.688 E F0(or)5.354 E F2(for)3.688 E(eac)-.37 E(h)
-.15 E F0 3.688(loop. A)5.354 F 1.188(common mistak)3.688 F 3.689(et)-.1
G 3.689(om)-3.689 G(ak)-3.689 E 3.689(ei)-.1 G(n)-3.689 E F2(csh)3.689 E
F0 1.189(scripts is to use)5.355 F F2(br)72 336 Q(eak)-.37 E F0
(rather than)4.166 E F2(br)2.5 E(eaksw)-.37 E F0(in switches.)4.166 E
(Finally)97 351.6 Q(,)-.65 E F2(csh)2.5 E F0(allo)4.166 E(ws a)-.25 E F2
(goto)2.5 E F0(statement, with labels looking lik)4.166 E 2.5(et)-.1 G
(he)-2.5 E 2.5(yd)-.15 G 2.5(oi)-2.5 G 2.5(nC)-2.5 G 2.5(,i)-2.5 G(.e.:)
-2.5 E(loop:)108 369.6 Q(commands)133 381.6 Q F1(goto)133 393.6 Q F0
(loop)2.5 E F1 2.5(3.8. Supplying)72 423.6 R(input to commands)2.5 E F0
576(Commands run from shell scripts recei)97 439.2 R .876 -.15(ve b)
-.25 H 3.076(yd).15 G(ef)-3.076 E .575
(ault the standard input of the shell which is running)-.1 F .213
(the script.)72 451.2 R .213(This is dif)5.213 F .213(ferent from pre)
-.25 F .213(vious shells running under)-.25 F/F3 8/Times-Roman@0 SF
(UNIX)2.713 E F0 5.214(.I)C 2.714(ta)-5.214 G(llo)-2.714 E .214
(ws shell scripts to fully partici-)-.25 F(pate in pipelines, b)72 463.2
Q(ut mandates e)-.2 E(xtra notation for commands which are to tak)-.15 E
2.5(ei)-.1 G(nline data.)-2.5 E .224(Thus we need a metanotation for su\
pplying inline data to commands in shell scripts.)97 478.8 R .223
(As an e)5.223 F(xample,)-.15 E(consider this script which runs the edi\
tor to delete leading blanks from the lines in each ar)72 490.8 Q
(gument \214le:)-.18 E 2.5(%c)108 508.8 S(at deblank)-2.5 E 2.5(#d)108
520.8 S(eblank \255\255 remo)-2.5 E .3 -.15(ve l)-.15 H(eading blanks)
15 E(foreach i \($ar)108 532.8 Q(gv\))-.18 E(ed \255 $i << \264EOF\264)
108 544.8 Q(1,$s/^[ ]*//)108 556.8 Q(w)108 568.8 Q(q)108 580.8 Q
<b4454f46b4>108 592.8 Q(end)108 604.8 Q(%)108 616.8 Q .296
(The notation `<< \264EOF\264' means that the standard input for the)72
634.8 R F2(ed)2.796 E F0 .296(command is to come from the te)4.462 F
297(xt in the)-.15 F .429(shell script \214le up to the ne)72 646.8 R
429(xt line consisting of e)-.15 F .428(xactly `\264EOF\264'.)-.15 F
428(The f)5.428 F .428(act that the `EOF' is enclosed in `\264')-.1 F
05(characters, i.e. quoted, causes the shell to not perform v)72 658.8
R .05(ariable substitution on the interv)-.25 F .05(ening lines.)-.15 F
05(In gen-)5.05 F .425(eral, if an)72 670.8 R 2.924(yp)-.15 G .424
(art of the w)-2.924 F .424(ord follo)-.1 F .424
(wing the `<<' which the shell uses to terminate the te)-.25 F .424
(xt to be gi)-.15 F -.15(ve)-.25 G 2.924(nt).15 G 2.924(ot)-2.924 G(he)
-2.924 E 1.247
(command is quoted then these substitutions will not be performed.)72
682.8 R 1.248(In this case since we used the form)6.248 F .363
(`1,$' in our editor script we needed to insure that this `$' w)72 694.8
R .363(as not v)-.1 F .363(ariable substituted.)-.25 F 1.963 -.8(We c)
5.363 H .363(ould also ha).8 F -.15(ve)-.2 G
(insured this by preceding the `$' here with a `\\', i.e.:)72 706.8 Q EP
%%Page: 30 30
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-30 An)72 52 R
(Introduction to the C shell)2.5 E(1,\\$s/^[ ]*//)108 90 Q -.2(bu)72 108
S 2.5(tq).2 G(uoting the `EOF' terminator is a more reliable w)-2.5 E
(ay of achie)-.1 E(ving the same thing.)-.25 E/F1 10/Times-Bold@0 SF 2.5
(3.9. Catching)72 132 R(interrupts)2.5 E F0 1.004(If our shell script c\
reates temporary \214les, we may wish to catch interruptions of the she\
ll script so)97 147.6 R(that we can clean up these \214les.)72 159.6 Q
1.6 -.8(We c)5 H(an then do).8 E(onintr label)108 177.6 Q(where)72 195.6
Q/F2 10/Times-Italic@0 SF(label)2.715 E F0 .215
(is a label in our program.)4.381 F .214(If an interrupt is recei)5.214
F -.15(ve)-.25 G 2.714(dt).15 G .214
(he shell will do a `goto label' and we can)-2.714 F(remo)72 207.6 Q
1.25 -.15(ve t)-.15 H .95(he temporary \214les and then do an).15 F F2
-.2(ex)3.45 G(it).2 E F0 .95(command \(which is b)5.116 F .95
(uilt in to the shell\) to e)-.2 F .951(xit from the)-.15 F
(shell script.)72 219.6 Q(If we wish to e)5 E
(xit with a non-zero status we can do)-.15 E -.15(ex)108 237.6 S
(it\(1\)).15 E(e.g. to e)72 255.6 Q(xit with status `1'.)-.15 E F1 2.5
(3.10. What)72 279.6 R(else?)2.5 E F0 1.288(There are other features of\
the shell useful to writers of shell procedures.)97 295.2 R(The)6.287 E
F2(verbose)3.787 E F0(and)5.453 E F2(ec)3.787 E(ho)-.15 E F0 .303
(options and the related)72 307.2 R F2<ad76>2.803 E F0(and)4.469 E F2
<ad78>2.803 E F0 .304(command line options can be used to help trace th\
e actions of the shell.)4.469 F(The)72 319.2 Q F2<ad6e>2.985 E F0 .485
(option causes the shell only to read commands and not to e)4.651 F -.15
(xe)-.15 G .485(cute them and may sometimes be of).15 F(use.)72 331.2 Q
029(One other thing to note is that)97 346.8 R F2(csh)2.529 E F0 .029
(will not e)4.195 F -.15(xe)-.15 G .029
(cute shell scripts which do not be).15 F .03(gin with the character)
-.15 F .192(`#', that is shell scripts that do not be)72 358.8 R .192
(gin with a comment.)-.15 F(Similarly)5.191 E 2.691(,t)-.65 G .191
(he `/bin/sh' on your system may well)-2.691 F .281
(defer to `csh' to interpret shell scripts which be)72 370.8 R .281
(gin with `#'.)-.15 F .281(This allo)5.281 F .281
(ws shell scripts for both shells to li)-.25 F -.15(ve)-.25 G(in harmon)
72 382.8 Q -.65(y.)-.15 G .17
(There is also another quotation mechanism using `"' which allo)97 398.4
R .169(ws only some of the e)-.25 F .169(xpansion mech-)-.15 F .693
(anisms we ha)72 410.4 R .993 -.15(ve s)-.2 H 3.193(of).15 G .693
(ar discussed to occur on the quoted string and serv)-3.293 F .693
(es to mak)-.15 F 3.193(et)-.1 G .693(his string into a single)-3.193 F
-.1(wo)72 422.4 S(rd as `\264' does.).1 E EP
%%Page: 31 31
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-31)271.17 E/F1 10
/Times-Bold@0 SF 2.5(4. Other)72 84 R 2.5(,l)-.92 G
(ess commonly used, shell featur)-2.5 E(es)-.18 E 2.5(4.1. Loops)72 108
R(at the terminal; v)2.5 E(ariables as v)-.1 E(ectors)-.1 E F0 1.116
(It is occasionally useful to use the)97 123.6 R/F2 10/Times-Italic@0 SF
(for)3.616 E(eac)-.37 E(h)-.15 E F0 1.115
(control structure at the terminal to aid in performing a)5.282 F .848
(number of similar commands.)72 135.6 R -.15(Fo)5.848 G 3.348(ri).15 G
848(nstance, there were at one point three shells in use on the Cory)
-3.348 F/F3 8/Times-Roman@0 SF(UNIX)3.349 E F0 .542
(system at Cory Hall, `/bin/sh', `/bin/nsh', and `/bin/csh'.)72 147.6 R
2.142 -.8(To c)5.542 H .542(ount the number of persons using each shell)
8 F(one could ha)72 159.6 Q .3 -.15(ve i)-.2 H(ssued the commands).15 E
2.5(%g)108 177.6 S(rep \255c csh$ /etc/passwd)-2.5 E(27)108 189.6 Q 2.5
(%g)108 201.6 S(rep \255c nsh$ /etc/passwd)-2.5 E(128)108 213.6 Q 2.5
(%g)108 225.6 S(rep \255c \255v sh$ /etc/passwd)-2.5 E(430)108 237.6 Q
(%)108 249.6 Q(Since these commands are v)72 267.6 Q
(ery similar we can use)-.15 E F2(for)2.5 E(eac)-.37 E(h)-.15 E F0
(to do this more easily)4.166 E(.)-.65 E 2.5(%f)108 285.6 S
(oreach i \(\264sh$\264 \264csh$\264 \264\255v sh$\264\))-2.5 E 2.5(?g)
108 297.6 S(rep \255c $i /etc/passwd)-2.5 E 2.5(?e)108 309.6 S(nd)-2.5 E
(27)108 321.6 Q(128)108 333.6 Q(430)108 345.6 Q(%)108 357.6 Q(Note here\
that the shell prompts for input with `? ' when reading the body of th\
e loop.)72 375.6 Q -1.11(Ve)97 391.2 S 1.07(ry useful with loops are v)
1.11 F 1.071(ariables which contain lists of \214lenames or other w)-.25
F 3.571(ords. Y)-.1 F 1.071(ou can, for)-1.1 F -.15(ex)72 403.2 S
(ample, do).15 E 2.5(%s)108 421.2 S(et a=\(\222ls\222\))-2.5 E 2.5(%e)
108 433.2 S(cho $a)-2.5 E(csh.n csh.rm)108 445.2 Q 2.5(%l)108 457.2 S(s)
-2.5 E(csh.n)108 469.2 Q(csh.rm)108 481.2 Q 2.5(%e)108 493.2 S(cho $#a)
-2.5 E(2)108 505.2 Q(%)108 517.2 Q(The)72 535.2 Q F2(set)2.996 E F0 .496
(command here g)4.662 F -2.25 -.2(av e)-.05 H .496(the v)3.196 F
(ariable)-.25 E F2(a)2.996 E F0 2.995(al)4.662 G .495
(ist of all the \214lenames in the current directory as v)-2.995 F 2.995
(alue. W)-.25 F(e)-.8 E(can then iterate o)72 547.2 Q -.15(ve)-.15 G 2.5
(rt).15 G(hese names to perform an)-2.5 E 2.5(yc)-.15 G(hosen function.)
-2.5 E .596(The output of a command within `\222' characters is con)97
562.8 R -.15(ve)-.4 G .596(rted by the shell to a list of w).15 F 3.096
(ords. Y)-.1 F .596(ou can)-1.1 F .852
(also place the `\222' quoted string within `"' characters to tak)72
574.8 R 3.352(ee)-.1 G .852
(ach \(non-empty\) line as a component of the)-3.352 F -.25(va)72 586.8
S .646(riable; pre).25 F -.15(ve)-.25 G .646
(nting the lines from being split into w).15 F .647
(ords at blanks and tabs.)-.1 F 3.147(Am)5.647 G .647(odi\214er `:x' e)
-3.147 F .647(xists which)-.15 F .831(can be used later to e)72 598.8 R
831(xpand each component of the v)-.15 F .83(ariable into another v)
-.25 F .83(ariable splitting it into separate)-.25 F -.1(wo)72 610.8 S
(rds at embedded blanks and tabs.).1 E F1 2.5(4.2. Braces)72 634.8 R 2.5
({.)2.5 G(.. } in ar)-2.5 E(gument expansion)-.1 E F0 1.373
(Another form of \214lename e)97 650.4 R 1.373
(xpansion, alluded to before in)-.15 F -.2(vo)-.4 G(lv).2 E 1.374
(es the characters `{' and `}'.)-.15 F(These)6.374 E 1.231
(characters specify that the contained strings, separated by `,)72 662.4
R 3.731('a)-.7 G 1.23(re to be consecuti)-3.731 F -.15(ve)-.25 G 1.23
(ly substituted into the).15 F(containing characters and the results e)
72 674.4 Q(xpanded left to right.)-.15 E(Thus)5 E(A{str1,str2,...strn}B)
108 692.4 Q -.15(ex)72 710.4 S(pands to).15 E EP
%%Page: 32 32
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-32 An)72 52 R
(Introduction to the C shell)2.5 E(Astr1B Astr2B ... AstrnB)108 90 Q
834(This e)72 108 R .834(xpansion occurs before the other \214lename e)
-.15 F .834(xpansions, and may be applied recursi)-.15 F -.15(ve)-.25 G
835(ly \(i.e. nested\).).15 F .382(The results of each e)72 120 R .382
(xpanded string are sorted separately)-.15 F 2.882(,l)-.65 G .382
(eft to right order being preserv)-2.882 F 2.881(ed. The)-.15 F
(resulting)2.881 E .123(\214lenames are not required to e)72 132 R .123
(xist if no other e)-.15 F .123(xpansion mechanisms are used.)-.15 F
123(This means that this mecha-)5.123 F
(nism can be used to generate ar)72 144 Q
(guments which are not \214lenames, b)-.18 E(ut which ha)-.2 E .3 -.15
(ve c)-.2 H(ommon parts.).15 E 2.5(At)97 159.6 S(ypical use of this w)
-2.5 E(ould be)-.1 E(mkdir ~/{hdrs,retro\214t,csh})108 177.6 Q .78
(to mak)72 195.6 R 3.28(es)-.1 G .78
(ubdirectories `hdrs', `retro\214t' and `csh' in your home directory)
-3.28 F 5.78(.T)-.65 G .78(his mechanism is most useful)-5.78 F
(when the common pre\214x is longer than in this e)72 207.6 Q
(xample, i.e.)-.15 E(cho)108 225.6 Q(wn root /usr/{ucb/{e)-.25 E
(x,edit},lib/{e)-.15 E(x?.?*,ho)-.15 E(w_e)-.25 E(x}})-.15 E/F1 10
/Times-Bold@0 SF 2.5(4.3. Command)72 255.6 R(substitution)2.5 E F0 3.002
(Ac)97 271.2 S .502(ommand enclosed in `\222' characters is replaced, j\
ust before \214lenames are e)-3.002 F .502(xpanded, by the output)-.15 F
(from that command.)72 283.2 Q(Thus it is possible to do)5 E
(set pwd=\222pwd\222)108 301.2 Q(to sa)72 319.2 Q .3 -.15(ve t)-.2 H
(he current directory in the v).15 E(ariable)-.25 E/F2 10/Times-Italic@0
SF(pwd)2.5 E F0(or to do)4.166 E .3 -.15(ex \222)108 337.2 T
(grep \255l TRA).15 E(CE *.c\222)-.4 E 1.56(to run the editor)72 355.2 R
F2 -.2(ex)4.059 G F0 1.559(supplying as ar)5.925 F 1.559
(guments those \214les whose names end in `.c' which ha)-.18 F 1.859
-.15(ve t)-.2 H 1.559(he string).15 F(`TRA)72 367.2 Q(CE' in them.*)-.4
E F1 2.5(4.4. Other)72 391.2 R(details not co)2.5 E -.1(ve)-.1 G -.18
(re).1 G 2.5(dh).18 G(er)-2.5 E(e)-.18 E F0 .59
(In particular circumstances it may be necessary to kno)97 406.8 R 3.089
(wt)-.25 G .589(he e)-3.089 F .589(xact nature and order of dif)-.15 F
589(ferent sub-)-.25 F 1.017(stitutions performed by the shell.)72
418.8 R 1.017(The e)6.017 F 1.018
(xact meaning of certain combinations of quotations is also occa-)-.15 F
(sionally important.)72 430.8 Q
(These are detailed fully in its manual section.)5 E .839(The shell has\
a number of command line option \215ags mostly of use in writing)97
446.4 R/F3 8/Times-Roman@0 SF(UNIX)3.338 E F0 .838(programs, and)3.338 F
(deb)72 458.4 Q(ugging shell scripts.)-.2 E
(See the csh\(1\) manual section for a list of these options.)5 E .32 LW
76 688 72 688 DL 80 688 76 688 DL 84 688 80 688 DL 88 688 84 688 DL 92
688 88 688 DL 96 688 92 688 DL 100 688 96 688 DL 104 688 100 688 DL 108
688 104 688 DL 112 688 108 688 DL 116 688 112 688 DL 120 688 116 688 DL
124 688 120 688 DL 128 688 124 688 DL 132 688 128 688 DL 136 688 132 688
DL 140 688 136 688 DL 144 688 140 688 DL F3 .017(*Command e)72 698 R
018(xpansion also occurs in input redirected with `<<' and within `"' \
quotations.)-.12 F .018(Refer to the shell manual section)4.018 F
(for full details.)72 708 Q EP
%%Page: 33 33
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-33)271.17 E/F1 10
/Times-Bold@0 SF -.25(Ap)72 84 S(pendix \255 Special characters).25 E F0
127(The follo)72 99.6 R .128
(wing table lists the special characters of)-.25 F/F2 10/Times-Italic@0
SF(csh)2.628 E F0 .128(and the)4.294 F/F3 8/Times-Roman@0 SF(UNIX)2.628
E F0 .128(system, gi)2.628 F .128(ving for each the section\(s\) in)-.25
F .267(which it is discussed.)72 111.6 R 2.766(An)5.266 G .266
(umber of these characters also ha)-2.766 F .566 -.15(ve s)-.2 H .266
(pecial meaning in e).15 F 2.766(xpressions. See)-.15 F(the)2.766 E F2
(csh)2.766 E F0(manual section for a complete list.)72 123.6 Q
(Syntactic metacharacters)72 139.2 Q 22.22(;2)108 157.2 S 10
(.4 separates)-22.22 F(commands to be e)2.5 E -.15(xe)-.15 G
(cuted sequentially).15 E 23(|1)108 169.2 S 10(.5 separates)-23 F
(commands in a pipeline)2.5 E 8.34 2.5(\(\) 2)108 181.2 T 20
(.2,3.6 brack)-2.5 F(ets e)-.1 E(xpressions and v)-.15 E(ariable v)-.25
E(alues)-.25 E 17.22(&2)108 193.2 S 10(.5 follo)-17.22 F
(ws commands to be e)-.25 E -.15(xe)-.15 G(cuted without w).15 E
(aiting for completion)-.1 E(Filename metacharacters)72 214.8 Q 22.22
(/1)108 232.8 S 10(.6 separates)-22.22 F(components of a \214le')2.5 E
2.5(sp)-.55 G(athname)-2.5 E 20.56(?1)108 244.8 S 10(.6 e)-20.56 F
(xpansion character matching an)-.15 E 2.5(ys)-.15 G(ingle character)
-2.5 E 20(*1)108 256.8 S 10(.6 e)-20 F(xpansion character matching an)
-.15 E 2.5(ys)-.15 G(equence of characters)-2.5 E 8.34 2.5([] 1)108
268.8 T 10(.6 e)-2.5 F(xpansion sequence matching an)-.15 E 2.5(ys)-.15
G(ingle character from a set)-2.5 E 21.67(~1)108 280.8 S 10(.6 used)
-21.67 F(at the be)2.5 E
(ginning of a \214lename to indicate home directories)-.15 E 5.4 2.5
({} 4)108 292.8 T 10(.2 used)-2.5 F(to specify groups of ar)2.5 E
(guments with common parts)-.18 E(Quotation metacharacters)72 314.4 Q
22.22(\\1)108 332.4 S 10(.7 pre)-22.22 F -.15(ve)-.25 G
(nts meta-meaning of follo).15 E(wing single character)-.25 E 21.67
<b431>108 344.4 S 10(.7 pre)-21.67 F -.15(ve)-.25 G
(nts meta-meaning of a group of characters).15 E 20.92("4)108 356.4 S 10
(.3 lik)-20.92 F 2.5<65b4>-.1 G 2.5(,b)-2.5 G(ut allo)-2.7 E(ws v)-.25 E
(ariable and command e)-.25 E(xpansion)-.15 E
(Input/output metacharacters)72 378 Q 19.36(<1)108 396 S 10
(.5 indicates)-19.36 F(redirected input)2.5 E 19.36(>1)108 408 S 10
(.3 indicates)-19.36 F(redirected output)2.5 E
(Expansion/substitution metacharacters)72 429.6 Q 20($3)108 447.6 S 10
(.4 indicates)-20 F -.25(va)2.5 G(riable substitution).25 E 21.67(!2)108
459.6 S 10(.3 indicates)-21.67 F(history substitution)2.5 E 22.22(:3)108
471.6 S 10(.6 precedes)-22.22 F(substitution modi\214ers)2.5 E 21.67(^2)
108 483.6 S 10(.3 used)-21.67 F
(in special forms of history substitution)2.5 E 21.67<9234>108 495.6 S
10(.3 indicates)-21.67 F(command substitution)2.5 E
(Other metacharacters)72 517.2 Q 20(#1)108 535.2 S 20(.3,3.6 be)-20 F
(gins scratch \214le names; indicates shell comments)-.15 E 19.36<ad31>
108 547.2 S 10(.2 pre\214x)-19.36 F(es option \(\215ag\) ar)-.15 E
(guments to commands)-.18 E 16.67(%2)108 559.2 S 10(.6 pre\214x)-16.67 F
(es job name speci\214cations)-.15 E EP
%%Page: 34 34
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-34 An)72 52 R
(Introduction to the C shell)2.5 E/F1 10/Times-Bold@0 SF(Glossary)72 84
Q F0 .429(This glossary lists the most important terms introduced in th\
e introduction to the shell and gi)97 99.6 R -.15(ve)-.25 G 2.929(sr).15
G(ef-)-2.929 E .86(erences to sections of the shell document for furthe\
r information about them.)72 111.6 R .86(References of the form `pr)5.86
F .603(\(1\)' indicate that the command)72 123.6 R/F2 10/Times-Italic@0
SF(pr)3.103 E F0 .603(is in the)4.769 F/F3 8/Times-Roman@0 SF(UNIX)3.104
E F0 .604(User Reference manual in section 1.)3.104 F -1.1(Yo)5.604 G
3.104(uc)1.1 G .604(an look at an)-3.104 F(online cop)72 135.6 Q 2.5(yo)
-.1 G 2.5(fi)-2.5 G(ts manual page by doing)-2.5 E(man 1 pr)108 153.6 Q
(References of the form \(2.5\) indicate that more information can be f\
ound in section 2.5 of this manual.)72 171.6 Q F1(.)72 187.2 Q F0 -1.1
(Yo)72.5 G 1.481(ur current directory has the name `.)1.1 F 3.981('a)-.7
G 3.981(sw)-3.981 G 1.48(ell as the name printed by the command)-3.981 F
F2(pwd;)147 199.2 Q F0 .394(see also)4.56 F F2(dir)2.894 E(s.)-.1 E F0
395(The current directory `.)4.561 F 2.895('i)-.7 G 2.895(su)-2.895 G
395(sually the \214rst)-2.895 F F2(component)2.895 E F0 .395
(of the search)4.561 F .257(path contained in the v)147 211.2 R(ariable)
-.25 E F2(path)2.756 E F0 2.756(,t)1.666 G .256
(hus commands which are in `.)-2.756 F 2.756('a)-.7 G .256
(re found \214rst \(2.2\).)-2.756 F .108(The character `.)147 223.2 R
2.608('i)-.7 G 2.609(sa)-2.608 G .109(lso used in separating)-2.609 F F2
(components)2.609 E F0 .109(of \214lenames \(1.6\).)4.275 F .109
(The character)5.109 F(`.)147 235.2 Q 3.102('a)-.7 G 3.102(tt)-3.102 G
602(he be)-3.102 F .602(ginning of a)-.15 F F2(component)3.102 E F0
602(of a)4.768 F F2(pathname)3.102 E F0 .602
(is treated specially and not matched)4.768 F(by the)147 247.2 Q F2
(\214lename e)2.5 E(xpansion)-.2 E F0
(metacharacters `?', `*', and `[' `]' pairs \(1.6\).)4.166 E F1(..)72
262.8 Q F0 1.847(Each directory has a \214le `..)70 F 4.347('i)-.7 G
4.347(ni)-4.347 G 4.347(tw)-4.347 G 1.847
(hich is a reference to its parent directory)-4.347 F 6.847(.A)-.65 G
(fter)-6.847 E(changing into the directory with)147 274.8 Q F2 -.15(ch)
2.5 G(dir).15 E F0 2.5(,i)1.666 G(.e.)-2.5 E(chdir paper)183 292.8 Q
(you can return to the parent directory by doing)147 310.8 Q(chdir ..)
183 328.8 Q(The current directory is printed by)147 346.8 Q F2(pwd)2.5 E
F0(\(2.7\).)4.166 E 52.78(a.out Compilers)72 362.4 R .639
(which create e)3.139 F -.15(xe)-.15 G .639
(cutable images create them, by def).15 F .639(ault, in the \214le)-.1 F
F2(a.out.)3.138 E F0(for)4.804 E(historical reasons \(2.3\).)147 374.4 Q
(absolute pathname)72 390 Q(A)147 402 Q F2(pathname)2.775 E F0 .275
(which be)4.441 F .275(gins with a `/' is)-.15 F F2(absolute)2.775 E F0
276(since it speci\214es the)4.442 F F2(path)2.776 E F0 .276
(of directories)4.442 F .032(from the be)147 414 R .031
(ginning of the entire directory system \255 called the)-.15 F F2 -.45
(ro)2.531 G(ot).45 E F0(directory)4.197 E(.)-.65 E F2 -.8(Pa)5.031 G
(thname).8 E F0(s)1.666 E(which are not)147 426 Q F2(absolute)2.5 E F0
(are called)4.166 E F2 -.37(re)2.5 G(lative).37 E F0
(\(see de\214nition of)4.166 E F2 -.37(re)2.5 G(lative pathname).37 E F0
2.5(\)\()1.666 G(1.6\).)-2.5 E 54.17(alias An)72 441.6 R F2(alias)3.083
E F0 .583(speci\214es a shorter or dif)4.749 F .583(ferent name for a)
-.25 F F3(UNIX)3.083 E F0 .583(command, or a transformation)3.083 F
1.711(on a command to be performed in the shell.)147 453.6 R 1.71
(The shell has a command)6.71 F F2(alias)4.21 E F0(which)5.876 E
(establishes)147 465.6 Q F2(aliases)3.167 E F0 .667
(and can print their current v)4.833 F 3.168(alues. The)-.25 F(command)
3.168 E F2(unalias)3.168 E F0 .668(is used to)4.834 F(remo)147 477.6 Q
-.15(ve)-.15 G F2(aliases)2.65 E F0(\(2.4\).)4.166 E(ar)72 493.2 Q 34.91
(gument Commands)-.18 F(in)2.5 E F3(UNIX)2.5 E F0(recei)2.5 E .3 -.15
(ve a l)-.25 H(ist of).15 E F2(ar)2.5 E(gument)-.37 E F0 -.1(wo)4.166 G
2.5(rds. Thus).1 F(the command)2.5 E(echo a b c)183 511.2 Q .878
(consists of the)147 529.2 R F2 .878(command name)3.378 F F0 .878
(`echo' and three)5.044 F F2(ar)3.378 E(gument)-.37 E F0 -.1(wo)5.044 G
877(rds `a', `b' and `c'.).1 F(The)5.877 E 1.007(set of)147 541.2 R F2
(ar)3.507 E(guments)-.37 E F0 1.007(after the)5.173 F F2 1.007
(command name)3.507 F F0 1.008(is said to be the)5.174 F F2(ar)3.508 E
1.008(gument list)-.37 F F0 1.008(of the com-)5.174 F(mand \(1.1\).)147
553.2 Q(ar)72 568.8 Q 54.91(gv The)-.18 F .521(list of ar)3.021 F .521(\
guments to a command written in the shell language \(a shell script or \
shell)-.18 F .574(procedure\) is stored in a v)147 580.8 R .574
(ariable called)-.25 F F2(ar)3.074 E(gv)-.37 E F0 .574
(within the shell.)4.74 F .575(This name is tak)5.574 F .575(en from)-.1
F(the con)147 592.8 Q -.15(ve)-.4 G
(ntional name in the C programming language \(3.4\).).15 E 25.29
(background Commands)72 608.4 R 1.391(started without w)3.891 F 1.39
(aiting for them to complete are called)-.1 F F2(bac)3.89 E(kgr)-.2 E
(ound)-.45 E F0(com-)5.556 E(mands \(2.6\).)147 620.4 Q 54.73(base A)72
636 R .184(\214lename is sometimes thought of as consisting of a)2.684 F
F2(base)2.684 E F0 .185(part, before an)4.35 F 2.685(y`)-.15 G 1.585 -.7
(.' c)-2.685 H(haracter).7 E(,)-.4 E .153(and an)147 648 R F2 -.2(ex)
2.653 G(tension).2 E F0 2.652<ad74>4.318 G .152(he part after the `.)
-2.652 F 2.652('. See)-.7 F F2(\214lename)2.652 E F0(and)4.318 E F2 -.2
(ex)2.652 G(tension).2 E F0 .152(\(1.6\) and basename)4.318 F(\(1\).)147
660 Q 62.5(bg The)72 675.6 R F2(bg)4.509 E F0 2.009(command causes a)
6.175 F F2(suspended)4.509 E F0 2.009(job to continue e)6.175 F -.15(xe)
-.15 G 2.01(cution in the).15 F F2(bac)4.51 E(kgr)-.2 E(ound)-.45 E F0
(\(2.6\).)147 687.6 Q 59.72(bin A)72 703.2 R .587
(directory containing binaries of programs and shell scripts to be e)
3.087 F -.15(xe)-.15 G .587(cuted is typically).15 F 1.754(called a)147
715.2 R F2(bin)4.254 E F0(directory)5.92 E 6.754(.T)-.65 G 1.754
(he standard system)-6.754 F F2(bin)4.254 E F0 1.754
(directories are `/bin' containing the)5.92 F 1.163(most hea)147 727.2 R
1.163(vily used commands and `/usr/bin' which contains most other user \
programs.)-.2 F EP
%%Page: 35 35
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-35)271.17 E 1.291
(Programs de)147 84 R -.15(ve)-.25 G 1.292(loped at UC Berk).15 F(ele)
-.1 E 3.792(yl)-.15 G -2.15 -.25(iv e)-3.792 H 1.292
(in `/usr/ucb', while locally written programs)4.042 F(li)147 96 Q .48
-.15(ve i)-.25 H 2.68(n`).15 G 2.68(/usr/local'. Games)-2.68 F .18
(are k)2.68 F .18(ept in the directory `/usr/g)-.1 F 2.68(ames'. Y)-.05
F .18(ou can place binaries)-1.1 F .006(in an)147 108 R 2.506(yd)-.15 G
(irectory)-2.506 E 5.007(.I)-.65 G 2.507(fy)-5.007 G .007(ou wish to e)
-2.507 F -.15(xe)-.15 G .007
(cute them often, the name of the directories should be).15 F(a)147 120
Q/F1 10/Times-Italic@0 SF(component)2.5 E F0(of the v)4.166 E(ariable)
-.25 E F1(path)2.5 E F0(.)1.666 E(break)72 135.6 Q F1(Br)52.79 E(eak)
-.37 E F0 .943(is a b)5.109 F .942(uiltin command used to e)-.2 F .942
(xit from loops within the control structure of the)-.15 F
(shell \(3.7\).)147 147.6 Q 39.18(breaksw The)72 163.2 R F1(br)4.122 E
(eaksw)-.37 E F0 -.2(bu)5.788 G 1.623(iltin command is used to e).2 F
1.623(xit from a)-.15 F F1(switc)4.123 E(h)-.15 E F0 1.623
(control structure, lik)5.789 F 4.123(ea)-.1 G F1(br)147 175.2 Q(eak)
-.37 E F0 -.15(ex)4.166 G(its from loops \(3.7\).).15 E -.2(bu)72 190.8
S 46.58(iltin A).2 F .003(command e)2.503 F -.15(xe)-.15 G .003
(cuted directly by the shell is called a).15 F F1 -.2(bu)2.502 G(iltin)
2 E F0 2.502(command. Most)4.168 F(commands)2.502 E(in)147 202.8 Q/F2 8
/Times-Roman@0 SF(UNIX)2.554 E F0 .054(are not b)2.554 F .054
(uilt into the shell, b)-.2 F .054(ut rather e)-.2 F .054
(xist as \214les in)-.15 F F1(bin)2.555 E F0 2.555(directories. These)
4.221 F(com-)2.555 E .398
(mands are accessible because the directories in which the)147 214.8 R
2.898(yr)-.15 G .398(eside are named in the)-2.898 F F1(path)2.898 E F0
-.25(va)147 226.8 S(riable.).25 E 55.29(case A)72 242.4 R F1(case)2.793
E F0 .293(command is used as a label in a)4.459 F F1(switc)2.793 E(h)
-.15 E F0 .293(statement in the shell')4.459 F 2.793(sc)-.55 G .293
(ontrol structure,)-2.793 F .552(similar to that of the language C.)147
254.4 R .552(Details are gi)5.552 F -.15(ve)-.25 G 3.052(ni).15 G 3.052
(nt)-3.052 G .552(he shell documentation `csh \(1\)')-3.052 F(\(3.7\).)
147 266.4 Q 60.84(cat The)72 282 R F1(cat)3.233 E F0 .734
(program catenates a list of speci\214ed \214les on the)4.899 F F1
(standar)3.234 E 3.234(do)-.37 G(utput)-3.234 E F0 5.734(.I)1.666 G
3.234(ti)-5.734 G 3.234(su)-3.234 G(sually)-3.234 E(used to look at the\
contents of a single \214le on the terminal, to `cat a \214le' \(1.8, \
2.3\).)147 294 Q 63.06(cd The)72 309.6 R F1(cd)4.398 E F0 1.897
(command is used to change the)6.063 F F1 1.897(working dir)4.397 F
(ectory)-.37 E F0 6.897(.W)1.666 G 1.897(ith no ar)-7.297 F(guments,)
-.18 E F1(cd)4.397 E F0(changes your)147 321.6 Q F1(working dir)2.5 E
(ectory)-.37 E F0(to be your)4.166 E F1(home)2.5 E F0
(directory \(2.4, 2.7\).)4.166 E 51.95(chdir The)72 337.2 R F1 -.15(ch)
3.861 G(dir).15 E F0 1.361(command is a synon)5.527 F 1.361(ym for)-.15
F F1(cd)3.861 E F0(.)1.666 E F1(Cd)6.361 E F0 1.362
(is usually used because it is easier to)5.527 F(type.)147 349.2 Q 54.17
(chsh The)72 364.8 R F1 -.15(ch)2.835 G(sh).15 E F0 .335
(command is used to change the shell which you use on)4.501 F F2(UNIX)
2.834 E F0 5.334(.B)C 2.834(yd)-5.334 G(ef)-2.834 E .334(ault, you)-.1 F
1.485(use an dif)147 376.8 R 1.485(ferent v)-.25 F 1.485
(ersion of the shell which resides in `/bin/sh'.)-.15 F -1.1(Yo)6.485 G
3.985(uc)1.1 G 1.485(an change your)-3.985 F
(shell to `/bin/csh' by doing)147 388.8 Q(chsh your)183 406.8 Q
(-login-name /bin/csh)-.2 E(Thus I w)147 424.8 Q(ould do)-.1 E
(chsh bill /bin/csh)183 442.8 Q .955
(It is only necessary to do this once.)147 460.8 R .954(The ne)5.954 F
954(xt time you log in to)-.15 F F2(UNIX)3.454 E F0 .954
(after doing this)3.454 F(command, you will be using)147 472.8 Q F1(csh)
2.5 E F0(rather than the shell in `/bin/sh' \(1.9\).)4.166 E(cmp)72
488.4 Q F1(Cmp)57.78 E F0 .871(is a program which compares \214les.)
5.037 F .872(It is usually used on binary \214les, or to see if)5.871 F
(tw)147 500.4 Q 2.825<6f8c>-.1 G .325(les are identical \(3.6\).)-2.825
F -.15(Fo)5.325 G 2.825(rc).15 G .325(omparing te)-2.825 F .324
(xt \214les the program)-.15 F F1(dif)2.824 E(f)-.18 E F0 2.824(,d)1.666
G .324(escribed in `dif)-2.824 F(f)-.25 E(\(1\)' is used.)147 512.4 Q
33.06(command A)72 528 R .089
(function performed by the system, either by the shell \(a b)2.589 F
(uiltin)-.2 E F1(command)2.589 E F0 2.589(\)o)1.666 G 2.589(rb)-2.589 G
2.589(yap)-2.589 G(ro-)-2.589 E
(gram residing in a \214le in a directory within the)147 540 Q F2(UNIX)
2.5 E F0(system, is called a)2.5 E F1(command)2.5 E F0(\(1.1\).)4.166 E
(command name)72 555.6 Q .794
(When a command is issued, it consists of a)147 567.6 R F1 .793
(command name)3.293 F F0 3.293(,w)1.666 G .793(hich is the \214rst w)
-3.293 F .793(ord of)-.1 F .097(the command, follo)147 579.6 R .097
(wed by ar)-.25 F 2.597(guments. The)-.18 F(con)2.597 E -.15(ve)-.4 G
097(ntion on).15 F F2(UNIX)2.597 E F0 .097(is that the \214rst w)2.597
F .098(ord of a)-.1 F
(command names the function to be performed \(1.1\).)147 591.6 Q
(command substitution)72 607.2 Q .093
(The replacement of a command enclosed in `\222' characters by the te)
147 619.2 R .093(xt output by that com-)-.15 F(mand is called)147 631.2
Q F1(command substitution)2.5 E F0(\(4.3\).)4.166 E 28.06(component A)72
646.8 R .158(part of a)2.658 F F1(pathname)2.658 E F0 .158
(between `/' characters is called a)4.324 F F1(component)2.658 E F0 .158
(of that)4.324 F F1(pathname)2.659 E F0 5.159(.A)1.666 G -.25(va)147
658.8 S 1.344(riable which has multiple strings as v).25 F 1.344
(alue is said to ha)-.25 F 1.644 -.15(ve s)-.2 H -2.15 -.25(ev e).15 H
(ral).25 E F1(component)3.844 E F0 1.344(s; each)1.666 F(string is a)147
670.8 Q F1(component)2.5 E F0(of the v)4.166 E(ariable.)-.25 E 38.06
(continue A)72 686.4 R -.2(bu)3.653 G 1.153
(iltin command which causes e).2 F -.15(xe)-.15 G 1.154
(cution of the enclosing).15 F F1(for)3.654 E(eac)-.37 E(h)-.15 E F0(or)
5.32 E F1(while)3.654 E F0 1.154(loop to)5.32 F -.15(cy)147 698.4 S
1.244(cle prematurely).15 F 6.243(.S)-.65 G 1.243(imilar to the)-6.243 F
F1(continue)3.743 E F0 1.243(command in the programming language C)5.409
F(\(3.6\).)147 710.4 Q EP
%%Page: 36 36
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-36 An)72 52 R
(Introduction to the C shell)2.5 E 40.84(control- Certain)72 84 R .734
(special characters, called)3.234 F/F1 10/Times-Italic@0 SF(contr)3.234
E(ol)-.45 E F0 .734(characters, are produced by holding do)4.9 F .734
(wn the)-.25 F/F2 8/Times-Roman@0 SF(CONTR)147 96 Q(OL)-.32 E F0 -.1(ke)
2.684 G 2.683(yo)-.05 G 2.683(ny)-2.683 G .183
(our terminal and simultaneously pressing another character)-2.683 F
2.683(,m)-.4 G .183(uch lik)-2.683 F(e)-.1 E(the)147 108 Q F2(SHIFT)
3.472 E F0 -.1(ke)3.472 G 3.472(yi)-.05 G 3.472(su)-3.472 G .972
(sed to produce upper case characters. Thus)-3.472 F F1(contr)3.472 E
(ol-)-.45 E F0 3.472(ci)1.666 G 3.473(sp)-3.472 G .973(roduced by)-3.473
F .389(holding do)147 120 R .389(wn the)-.25 F F2(CONTR)2.889 E(OL)-.32
E F0 -.1(ke)2.889 G 2.889(yw)-.05 G .389(hile pressing the `c' k)-2.889
F -.15(ey)-.1 G 5.389(.U)-.5 G(sually)-5.389 E F2(UNIX)2.888 E F0 .388
(prints an caret)2.888 F .398(\(^\) follo)147 132 R .398
(wed by the corresponding letter when you type a)-.25 F F1(contr)2.898 E
(ol)-.45 E F0 .399(character \(e.g. `^C' for)4.564 F F1(contr)147 144 Q
(ol-)-.45 E F0 2.5(c\()1.666 G(1.8\).)-2.5 E(core dump)72 159.6 Q .765
(When a program terminates abnormally)32.51 F 3.265(,t)-.65 G .764
(he system places an image of its current state)-3.265 F .353
(in a \214le named `core'.)147 171.6 R(This)5.353 E F1(cor)2.853 E 2.853
(ed)-.37 G(ump)-2.853 E F0 .353(can be e)4.519 F .353
(xamined with the system deb)-.15 F .353(ugger `adb)-.2 F .842(\(1\)' o\
r `sdb \(1\)' in order to determine what went wrong with the program \(\
1.8\).)147 183.6 R .841(If the)5.841 F
(shell produces a message of the form)147 195.6 Q(Ille)183 213.6 Q -.05
(ga)-.15 G 2.5(li).05 G(nstruction \(core dumped\))-2.5 E .615
(\(where `Ille)147 231.6 R -.05(ga)-.15 G 3.115(li).05 G .615
(nstruction' is only one of se)-3.115 F -.15(ve)-.25 G .615
(ral possible messages\), you should report).15 F
(this to the author of the program or a system administrator)147 243.6 Q
2.5(,s)-.4 G -.2(av)-2.5 G(ing the `core' \214le.).2 E 63.06(cp The)72
259.2 R F1(cp)2.595 E F0(\(cop)4.261 E .094(y\) program is used to cop)
-.1 F 2.594(yt)-.1 G .094
(he contents of one \214le into another \214le.)-2.594 F .094(It is one)
5.094 F(of the most commonly used)147 271.2 Q F2(UNIX)2.5 E F0
(commands \(1.6\).)2.5 E 59.17(csh The)72 286.8 R
(name of the shell program that this document describes.)2.5 E 48.9
(.cshrc The)72 302.4 R(\214le)2.963 E F1(.cshr)2.963 E(c)-.37 E F0 .463
(in your)4.629 F F1(home)2.963 E F0 .463
(directory is read by each shell as it be)4.629 F .464(gins e)-.15 F
-.15(xe)-.15 G 2.964(cution. It).15 F(is)2.964 E .172
(usually used to change the setting of the v)147 314.4 R(ariable)-.25 E
F1(path)2.672 E F0 .172(and to set)4.338 F F1(alias)2.672 E F0 .171
(parameters which)4.337 F(are to tak)147 326.4 Q 2.5(ee)-.1 G -.25(ff)
-2.5 G(ect globally \(2.1\).).25 E 55.84(cwd The)72 342 R F1(cwd)4.791 E
F0 -.25(va)6.457 G 2.291(riable in the shell holds the).25 F F1 2.292
(absolute pathname)4.791 F F0 2.292(of the current)6.458 F F1(working)
4.792 E(dir)147 354 Q(ectory)-.37 E F0 5.731(.I)1.666 G 3.231(ti)-5.731
G 3.231(sc)-3.231 G .731(hanged by the shell whene)-3.231 F -.15(ve)-.25
G 3.231(ry).15 G .73(our current)-3.231 F F1 .73(working dir)3.23 F
(ectory)-.37 E F0(changes)4.896 E
(and should not be changed otherwise \(2.2\).)147 366 Q 55.84(date The)
72 381.6 R F1(date)2.5 E F0
(command prints the current date and time \(1.3\).)4.166 E(deb)72 397.2
Q(ugging)-.2 E F1(Deb)32.98 E(ug)-.2 E(ging)-.1 E F0 .124
(is the process of correcting mistak)4.29 F .124
(es in programs and shell scripts.)-.1 F .125(The shell)5.125 F(has se)
147 409.2 Q -.15(ve)-.25 G(ral options and v).15 E
(ariables which may be used to aid in shell)-.25 E F1(deb)2.5 E(ug)-.2 E
(ging)-.1 E F0(\(4.4\).)4.166 E(def)72 424.8 Q 42.05(ault: The)-.1 F
(label)3.555 E F1(default:)3.555 E F0 1.055(is used within shell)5.221 F
F1(switc)3.555 E(h)-.15 E F0 1.055
(statements, as it is in the C language to)5.221 F .824
(label the code to be e)147 436.8 R -.15(xe)-.15 G .824
(cuted if none of the).15 F F1(case)3.324 E F0 .824
(labels matches the v)4.99 F .824(alue switched on)-.25 F(\(3.7\).)147
448.8 Q F2(DELETE)72 464.4 Q F0(The)44.784 E F2(DELETE)2.574 E F0(or)
2.574 E F2 -.32(RU)2.574 G(BOUT).32 E F0 -.1(ke)2.574 G 2.574(yo)-.05 G
2.574(nt)-2.574 G .073
(he terminal normally causes an interrupt to be sent to the)-2.574 F
(current job)147 476.4 Q 5(.M)-.4 G(an)-5 E 2.5(yu)-.15 G
(sers change the interrupt character to be ^C.)-2.5 E 36.96(detached A)
72 492 R 1.659(command that continues running in the)4.159 F F1(bac)4.16
E(kgr)-.2 E(ound)-.45 E F0 1.66(after you logout is said to be)5.826 F
F1(detac)147 504 Q(hed)-.15 E F0(.)1.666 E 31.39(diagnostic An)72 519.6
R .054(error message produced by a program is often referred to as a)
2.554 F F1(dia)2.553 E(gnostic)-.1 E F0 5.053(.M)1.666 G .053(ost error)
-5.053 F .766(messages are not written to the)147 531.6 R F1(standar)
3.266 E 3.266(do)-.37 G(utput)-3.266 E F0 3.266(,s)1.666 G .766
(ince that is often directed a)-3.266 F -.1(wa)-.15 G 3.266(yf).1 G(rom)
-3.266 E 1.822(the terminal \(1.3, 1.5\).)147 543.6 R 1.822
(Error messsages are instead written to the)6.822 F F1(dia)4.322 E 1.822
(gnostic output)-.1 F F0 .124(which may be directed a)147 555.6 R -.1
(wa)-.15 G 2.624(yf).1 G .125(rom the terminal, b)-2.624 F .125
(ut usually is not.)-.2 F(Thus)5.125 E F1(dia)2.625 E(gnostics)-.1 E F0
(will)4.291 E(usually appear on the terminal \(2.5\).)147 567.6 Q 36.4
(directory A)72 583.2 R .502(structure which contains \214les.)3.002 F
502(At an)5.502 F 3.002(yt)-.15 G .502(ime you are in one particular)
-3.002 F F1(dir)3.001 E(ectory)-.37 E F0(whose)4.667 E 1.109
(names can be printed by the command)147 595.2 R F1(pwd)3.609 E F0 6.109
(.T)1.666 G(he)-6.109 E F1 -.15(ch)3.609 G(dir).15 E F0 1.109
(command will change you to)5.275 F(another)147 607.2 Q F1(dir)3.541 E
(ectory)-.37 E F0 3.541(,a)1.666 G 1.041(nd mak)-3.541 F 3.541(et)-.1 G
1.041(he \214les in that)-3.541 F F1(dir)3.541 E(ectory)-.37 E F0 1.041
(visible. The)5.207 F F1(dir)3.541 E(ectory)-.37 E F0 1.04(in which)
5.207 F(you are when you \214rst login is your)147 619.2 Q F1(home)2.5 E
F0(directory \(1.1, 2.7\).)4.166 E(directory stack)72 634.8 Q .852
(The shell sa)15.85 F -.15(ve)-.2 G 3.353(st).15 G .853(he names of pre)
-3.353 F(vious)-.25 E F1 .853(working dir)3.353 F(ectories)-.37 E F0
853(in the)5.019 F F1(dir)3.353 E .853(ectory stac)-.37 F(k)-.2 E F0
(when)5.019 E 2.047(you change your current)147 646.8 R F1 2.047
(working dir)4.547 F(ectory)-.37 E F0 2.047(via the)6.213 F F1(pushd)
4.547 E F0 4.547(command. The)6.213 F F1(dir)4.547 E(ectory)-.37 E(stac)
147 658.8 Q(k)-.2 E F0 .821(can be printed by using the)4.987 F F1(dir)
3.321 E(s)-.1 E F0 .822(command, which includes your current)4.987 F F1
(working)3.322 E(dir)147 670.8 Q(ectory)-.37 E F0
(as the \214rst directory name on the left \(2.7\).)4.166 E 57.5
(dirs The)72 686.4 R F1(dir)2.5 E(s)-.1 E F0(command prints the shell')
4.166 E(s)-.55 E F1(dir)2.5 E(ectory stac)-.37 E(k)-.2 E F0(\(2.7\).)
4.166 E 62.5(du The)72 702 R F1(du)3.286 E F0 .786(command is a program\
\(described in `du \(1\)'\) which prints the number of disk)4.952 F
(blocks is all directories belo)147 714 Q 2.5(wa)-.25 G
(nd including your current)-2.5 E F1(working dir)2.5 E(ectory)-.37 E F0
(\(2.6\).)4.166 E EP
%%Page: 37 37
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-37)271.17 E 53.62
(echo The)72 84 R/F1 10/Times-Italic@0 SF(ec)2.5 E(ho)-.15 E F0
(command prints its ar)4.166 E(guments \(1.6, 3.6\).)-.18 E 56.95
(else The)72 99.6 R F1(else)2.5 E F0
(command is part of the `if-then-else-endif)4.166 E 2.5('c).55 G
(ontrol command construct \(3.6\).)-2.5 E 51.95(endif If)72 115.2 R(an)
2.537 E F1(if)2.537 E F0 .037(statement is ended with the w)4.203 F(ord)
-.1 E F1(then)2.537 E F0 2.537(,a)1.666 G .038(ll lines follo)-2.537 F
038(wing the)-.25 F F1(if)2.538 E F0 .038(up to a line start-)4.204 F
694(ing with the w)147 127.2 R(ord)-.1 E F1(endif)3.194 E F0(or)4.86 E
F1(else)3.194 E F0 .693(are e)4.859 F -.15(xe)-.15 G .693
(cuted if the condition between parentheses after).15 F(the)147 139.2 Q
F1(if)2.5 E F0(is true \(3.6\).)4.166 E/F2 8/Times-Roman@0 SF(EOF)72
154.8 Q F0(An)59.888 E F1(end)3.887 E F0(-)A F1(of)A F0(-)A F1(\214le)A
F0 1.387(is generated by the terminal by a control-d, and whene)5.553 F
-.15(ve)-.25 G 3.888(rac).15 G(ommand)-3.888 E .932
(reads to the end of a \214le which it has been gi)147 166.8 R -.15(ve)
-.25 G 3.432(na).15 G 3.432(si)-3.432 G 3.432(nput. Commands)-3.432 F
(recei)3.431 E .931(ving input)-.25 F 1.293(from a)147 178.8 R F1(pipe)
3.793 E F0(recei)5.459 E 1.593 -.15(ve a)-.25 H(n).15 E F1(end)3.793 E
F0(-)A F1(of)A F0(-)A F1(\214le)A F0 1.293
(when the command sending them input completes.)5.459 F .607
(Most commands terminate when the)147 190.8 R 3.107(yr)-.15 G(ecei)
-3.107 E .907 -.15(ve a)-.25 H(n).15 E F1(end)3.106 E F0(-)A F1(of)A F0
(-)A F1(\214le)A F0 5.606(.T)1.666 G .606(he shell has an option to)
-5.606 F(ignore)147 202.8 Q F1(end)2.574 E F0(-)A F1(of)A F0(-)A F1
(\214le)A F0 .074(from a terminal input which may help you k)4.24 F .075
(eep from logging out acci-)-.1 F(dentally by typing too man)147 214.8 Q
2.5(yc)-.15 G(ontrol-d')-2.5 E 2.5(s\()-.55 G(1.1, 1.8, 3.8\).)-2.5 E
45.85(escape A)72 230.4 R .519(character `\\' used to pre)3.019 F -.15
(ve)-.25 G .519(nt the special meaning of a metacharacter is said to).15
F F1(escape)3.018 E F0(the character from its special meaning.)147 242.4
Q(Thus)5 E(echo \\*)183 260.4 Q(will echo the character `*' while just)
147 278.4 Q(echo *)183 296.4 Q 1.029
(will echo the names of the \214le in the current directory)147 314.4 R
6.03(.I)-.65 G 3.53(nt)-6.03 G 1.03(his e)-3.53 F 1.03(xample, \\)-.15 F
F1(escape)3.53 E F0 3.53(s`)1.666 G(*')-3.53 E 3.086(\(1.7\). There)147
326.4 R .585(is also a non-printing character called)3.086 F F1(escape)
3.085 E F0 3.085(,u)1.666 G .585(sually labelled)-3.085 F F2(ESC)3.085 E
F0(or)3.085 E F2(AL)3.085 E -.736(T-)-.736 G(MODE)147 338.4 Q F0 1.284
(on terminal k)3.784 F -.15(ey)-.1 G 3.784(boards. Some).15 F(older)
3.785 E F2(UNIX)3.785 E F0 1.285(systems use this character to indicate)
3.785 F .745(that output is to be)147 350.4 R F1(suspended)3.245 E F0
5.745(.M)1.666 G .745
(ost systems use control-s to stop the output and con-)-5.745 F
(trol-q to start it.)147 362.4 Q 25.84(/etc/passwd This)72 378 R .519(\
\214le contains information about the accounts currently on the system.)
3.019 F .52(It consists of)5.52 F 2.856(al)147 390 S .356(ine for each \
account with \214elds separated by `:' characters \(1.8\).)-2.856 F -1.1
(Yo)5.355 G 2.855(uc)1.1 G .355(an look at this)-2.855 F
(\214le by saying)147 402 Q(cat /etc/passwd)183 420 Q .261(The commands)
147 438 R F1(\214ng)2.761 E(er)-.1 E F0(and)4.427 E F1(gr)2.761 E(ep)
-.37 E F0 .261(are often used to search for information in this \214le.)
4.427 F(See)5.262 E
(`\214nger \(1\)', `passwd\(5\)', and `grep \(1\)' for more details.)147
450 Q -.15(ex)72 465.6 S 57.65(it The).15 F F1 -.2(ex)2.611 G(it).2 E F0
11(command is used to force termination of a shell script, and is b)
4.277 F .11(uilt into the shell)-.2 F(\(3.9\).)147 477.6 Q -.15(ex)72
493.2 S(it status).15 E 2.75(Ac)34.87 G .25(ommand which disco)-2.75 F
-.15(ve)-.15 G .25
(rs a problem may re\215ect this back to the command \(such as a).15 F
051(shell\) which in)147 505.2 R -.2(vo)-.4 G -.1(ke).2 G 2.551(d\().1
G -.15(exe)-2.551 G .051(cuted\) it.).15 F .051
(It does this by returning a non-zero number as its)5.051 F F1 -.2(ex)
2.55 G(it).2 E(status)147 517.2 Q F0 3.359(,as)1.666 G .86
(tatus of zero being considered `normal termination'.)-3.359 F(The)5.86
E F1 -.2(ex)3.36 G(it).2 E F0 .86(command can)5.026 F
(be used to force a shell command script to gi)147 529.2 Q .3 -.15
(ve a n)-.25 H(on-zero).15 E F1 -.2(ex)2.5 G(it status).2 E F0(\(3.6\).)
4.166 E -.15(ex)72 544.8 S 32.1(pansion The).15 F 1.977(replacement of \
strings in the shell input which contain metacharacters by other)4.478 F
473(strings is referred to as the process of)147 556.8 R F1 -.2(ex)
2.974 G(pansion).2 E F0 5.474(.T)1.666 G .474
(hus the replacement of the w)-5.474 F .474(ord `*')-.1 F .794(by a sor\
ted list of \214les in the current directory is a `\214lename e)147
568.8 R 3.294(xpansion'. Similarly)-.15 F(the)3.294 E 1.066
(replacement of the characters `!!' by the te)147 580.8 R 1.067
(xt of the last command is a `history e)-.15 F(xpan-)-.15 E(sion'.)147
592.8 Q F1(Expansions)5 E F0(are also referred to as)4.166 E F1
(substitutions)2.5 E F0(\(1.6, 3.4, 4.2\).)4.166 E -.15(ex)72 608.4 S
(pressions).15 E F1(Expr)28.49 E(essions)-.37 E F0 .251(are used in the\
shell to control the conditional structures used in the writing)4.417 F
1.558(of shell scripts and in calculating v)147 620.4 R 1.559
(alues for these scripts.)-.25 F 1.559(The operators a)6.559 F -.25(va)
-.2 G 1.559(ilable in).25 F(shell)147 632.4 Q F1 -.2(ex)2.5 G(pr).2 E
(essions)-.37 E F0(are those of the language C \(3.5\).)4.166 E -.15(ex)
72 648 S 34.32(tension Filenames).15 F .532(often consist of a)3.032 F
F1(base)3.031 E F0 .531(name and an)4.697 F F1 -.2(ex)3.031 G(tension).2
E F0 .531(separated by the character `.)4.697 F('.)-.7 E .536(By con)147
660 R -.15(ve)-.4 G .536
(ntion, groups of related \214les often share the same).15 F F1 -.45(ro)
3.036 G(ot).45 E F0 3.036(name. Thus)4.702 F .536(if `prog.c')3.036 F
1.625(were a C program, then the object \214le for this program w)147
672 R 1.625(ould be stored in `prog.o'.)-.1 F 2.714
(Similarly a paper written with the `\255me' nrof)147 684 R 5.214(fm)
-.25 G 2.714(acro package might be stored in)-5.214 F(`paper)147 696 Q
284(.me' while a formatted v)-.55 F .283
(ersion of this paper might be k)-.15 F .283(ept in `paper)-.1 F .283
(.out' and a list)-.55 F(of spelling errors in `paper)147 708 Q
(.errs' \(1.6\).)-.55 E EP
%%Page: 38 38
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-38 An)72 52 R
(Introduction to the C shell)2.5 E 64.17(fg The)72 84 R/F1 10
/Times-Italic@0 SF .427(job contr)2.927 F(ol)-.45 E F0(command)4.593 E
F1(fg)2.927 E F0 .427(is used to run a)4.593 F F1(bac)2.927 E(kgr)-.2 E
(ound)-.45 E F0(or)4.593 E F1(suspended)2.927 E F0 .428(job in the)4.594
F F1(for)2.928 E(e-)-.37 E(gr)147 96 Q(ound)-.45 E F0(\(1.8, 2.6\).)
4.166 E 38.06(\214lename Each)72 111.6 R 1.413(\214le in)3.913 F/F2 8
/Times-Roman@0 SF(UNIX)3.913 E F0 1.413
(has a name consisting of up to 14 characters and not including the)
3.913 F .329(character `/' which is used in)147 123.6 R F1(pathname)
2.829 E F0 -.2(bu)4.495 G 2.829(ilding. Most).2 F F1(\214lenames)2.829 E
F0 .329(do not be)4.495 F .33(gin with the)-.15 F 1.181(character `.)147
135.6 R 1.181(', and contain only letters and digits with perhaps a `.)
-.7 F 3.681('s)-.7 G 1.181(eparating the)-3.681 F F1(base)3.681 E F0
(portion of the)147 147.6 Q F1(\214lename)2.5 E F0(from an)4.166 E F1
-.2(ex)2.5 G(tension).2 E F0(\(1.6\).)4.166 E(\214lename e)72 163.2 Q
(xpansion)-.15 E F1 -.45(Fi)147 175.2 S 1.338(lename e).45 F(xpansion)
-.2 E F0 1.339(uses the metacharacters `*', `?' and `[' and `]' to pro)
5.504 F 1.339(vide a con-)-.15 F -.15(ve)147 187.2 S .171
(nient mechanism for naming \214les.).15 F(Using)5.17 E F1 .17
(\214lename e)2.67 F(xpansion)-.2 E F0 .17(it is easy to name all the)
4.336 F .03(\214les in the current directory)147 199.2 R 2.53(,o)-.65 G
2.53(ra)-2.53 G .03(ll \214les which ha)-2.53 F .33 -.15(ve a c)-.2 H
(ommon).15 E F1 -.45(ro)2.531 G(ot).45 E F0 .031(name. Other)4.197 F F1
(\214lename)2.531 E -.2(ex)147 211.2 S(pansion).2 E F0 .628
(mechanisms use the metacharacter `~' and allo)4.794 F 3.128<778c>-.25 G
628(les in other users' directo-)-3.128 F
(ries to be named easily \(1.6, 4.2\).)147 223.2 Q 57.5(\215ag Man)72
238.8 R(y)-.15 E F2(UNIX)2.989 E F0 .489(commands accept ar)2.989 F .489
(guments which are not the names of \214les or other users)-.18 F -.2
(bu)147 250.8 S 4.751(ta).2 G 2.251
(re used to modify the action of the commands.)-4.751 F 2.251
(These are referred to as)7.251 F F1<8d61>4.75 E(g)-.1 E F0 .757
(options, and by con)147 262.8 R -.15(ve)-.4 G .757
(ntion consist of one or more letters preceded by the character `\255')
15 F 2.592(\(1.2\). Thus)147 274.8 R(the)2.592 E F1(ls)2.592 E F0 .091
(\(list \214les\) command has an option `\255s' to list the sizes of \
\214les.)4.258 F .091(This is)5.091 F(speci\214ed)147 286.8 Q(ls \255s)
183 304.8 Q 42.52(foreach The)72 326.4 R F1(for)2.8 E(eac)-.37 E(h)-.15
E F0 .3(command is used in shell scripts and at the terminal to specify\
repetition of)4.466 F 3.995(as)147 338.4 S 1.495
(equence of commands while the v)-3.995 F 1.494
(alue of a certain shell v)-.25 F 1.494(ariable ranges through a)-.25 F
(speci\214ed list \(3.6, 4.1\).)147 350.4 Q(fore)72 366 Q 28.22
(ground When)-.15 F .262(commands are e)2.762 F -.15(xe)-.15 G .262
(cuting in the normal w).15 F .263(ay such that the shell is w)-.1 F
263(aiting for them)-.1 F .76
(to \214nish before prompting for another command the)147 378 R 3.26(ya)
-.15 G .759(re said to be)-3.26 F F1(for)3.259 E -.4(eg)-.37 G -.45(ro)
4 G .759(und jobs).45 F F0(or)4.925 E F1 .537(running in the for)147
390 R -.4(eg)-.37 G -.45(ro).4 G(und).45 E F0 5.538(.T)1.666 G .538
(his is as opposed to)-5.538 F F1(bac)3.038 E(kgr)-.2 E(ound)-.45 E F0
(.)1.666 E F1 -1.05(Fo)5.538 G -.37(re)1.05 G(gr)-.03 E(ound)-.45 E F0
538(jobs can be)4.704 F .413
(stopped by signals from the terminal caused by typing dif)147 402 R
413(ferent control characters at the)-.25 F -.1(ke)147 414 S
(yboard \(1.8, 2.6\).)-.05 E 54.72(goto The)72 429.6 R .916
(shell has a command)3.416 F F1(goto)3.416 E F0 .917
(used in shell scripts to transfer control to a gi)5.082 F -.15(ve)-.25
G 3.417(nl).15 G(abel)-3.417 E(\(3.7\).)147 441.6 Q 54.73(grep The)72
457.2 R F1(gr)2.5 E(ep)-.37 E F0(command searches through a list of ar)
4.166 E(gument \214les for a speci\214ed string.)-.18 E(Thus)5 E
(grep bill /etc/passwd)183 475.2 Q 1.658
(will print each line in the \214le)147 493.2 R F1(/etc/passwd)4.158 E
F0 1.658(which contains the string `bill'.)5.824 F(Actually)6.658 E(,)
-.65 E F1(gr)147 505.2 Q(ep)-.37 E F0 .061(scans for)4.227 F F1 -.37(re)
2.561 G .061(gular e)-.03 F(xpr)-.2 E(essions)-.37 E F0 .061
(in the sense of the editors `ed \(1\)' and `e)4.227 F 2.562(x\()-.15 G
(1\)'.)-2.562 E F1(Gr)5.062 E(ep)-.37 E F0(stands for `globally \214nd)
147 517.2 Q F1 -.37(re)2.5 G(gular e)-.03 E(xpr)-.2 E(ession)-.37 E F0
(and print' \(2.4\).)4.166 E 53.62(head The)72 532.8 R F1(head)2.567 E
F0 .067(command prints the \214rst fe)4.233 F 2.566(wl)-.25 G .066
(ines of one or more \214les.)-2.566 F .066(If you ha)5.066 F .366 -.15
(ve a b)-.2 H .066(unch of)-.05 F .718(\214les containing te)147 544.8 R
718(xt which you are w)-.15 F .718
(ondering about it is sometimes useful to run)-.1 F F1(head)3.219 E F0
465(with these \214les as ar)147 556.8 R 2.965(guments. This)-.18 F
465(will usually sho)2.965 F 2.965(we)-.25 G .465
(nough of what is in these \214les to)-2.965 F
(let you decide which you are interested in \(1.5\).)147 568.8 Q F1
(Head)147 580.8 Q F0 1.032(is also used to describe the part of a)5.197
F F1(pathname)3.532 E F0 1.032(before and including the last `/')5.198 F
(character)147 592.8 Q 5.073(.T)-.55 G(he)-5.073 E F1(tail)2.573 E F0
073(of a)4.239 F F1(pathname)2.573 E F0 .073
(is the part after the last `/'.)4.239 F .072
(The `:h' and `:t' modi\214ers)5.073 F(allo)147 604.8 Q 2.5(wt)-.25 G
(he)-2.5 E F1(head)2.5 E F0(or)4.166 E F1(tail)2.5 E F0(of a)4.166 E F1
(pathname)2.5 E F0(stored in a shell v)4.166 E
(ariable to be used \(3.6\).)-.25 E 44.72(history The)72 620.4 R F1
(history)3.058 E F0 .558(mechanism of the shell allo)4.724 F .559
(ws pre)-.25 F .559(vious commands to be repeated, possibly)-.25 F .465
(after modi\214cation to correct typing mistak)147 632.4 R .464
(es or to change the meaning of the command.)-.1 F .049(The shell has a)
147 644.4 R F1 .05(history list)2.55 F F0 .05
(where these commands are k)4.216 F .05(ept, and a)-.1 F F1(history)2.55
E F0 -.25(va)4.216 G .05(riable which).25 F(controls ho)147 656.4 Q 2.5
(wl)-.25 G(ar)-2.5 E(ge this list is \(2.3\).)-.18 E(home directory)72
672 Q 2.029(Each user has a)147 684 R F1 2.028(home dir)4.529 F(ectory)
-.37 E F0 4.528(,w)1.666 G 2.028(hich is gi)-4.528 F -.15(ve)-.25 G
4.528(ni).15 G 4.528(ny)-4.528 G 2.028(our entry in the passw)-4.528 F
2.028(ord \214le,)-.1 F F1(/etc/passwd)147 696 Q F0 5.228(.T)1.666 G
228
(his is the directory which you are placed in when you \214rst login.)
-5.228 F(The)5.229 E F1(cd)2.729 E F0(or)147 708 Q F1 -.15(ch)3.497 G
(dir).15 E F0 .997(command with no ar)5.163 F .997(guments tak)-.18 F
997(es you back to this directory)-.1 F 3.496(,w)-.65 G .996
(hose name is)-3.496 F .629(recorded in the shell v)147 720 R(ariable)
-.25 E F1(home)3.129 E F0 5.629(.Y)1.666 G .629(ou can also access the)
-6.729 F F1 .629(home dir)3.129 F(ectories)-.37 E F0 .63(of other)4.796
F EP
%%Page: 39 39
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-39)271.17 E 1.671
(users in forming \214lenames using a)147 84 R/F1 10/Times-Italic@0 SF
1.67(\214lename e)4.17 F(xpansion)-.2 E F0 1.67
(notation and the character `~')5.836 F(\(1.6\).)147 96 Q 66.39(if A)72
111.6 R 1.821(conditional command within the shell, the)4.321 F F1(if)
4.321 E F0 1.821(command is used in shell command)5.987 F
(scripts to mak)147 123.6 Q 2.5(ed)-.1 G
(ecisions about what course of action to tak)-2.5 E 2.5(en)-.1 G -.15
(ex)-2.5 G 2.5(t\().15 G(3.6\).)-2.5 E 34.18(ignoreeof Normally)72 139.2
R 2.677(,y)-.65 G .177(our shell will e)-2.677 F .177
(xit, printing `logout' if you type a control-d at a prompt of `%)-.15 F
2.921('. This)147 151.2 R .421(is the w)2.921 F .421
(ay you usually log of)-.1 F 2.922(ft)-.25 G .422(he system.)-2.922 F
-1.1(Yo)5.422 G 2.922(uc)1.1 G(an)-2.922 E F1(set)2.922 E F0(the)4.588 E
F1(ignor)2.922 E(eeof)-.37 E F0 -.25(va)4.588 G .422(riable if).25 F
537(you wish in your)147 163.2 R F1(.lo)3.037 E(gin)-.1 E F0 .537
(\214le and then use the command)4.703 F F1(lo)3.037 E(gout)-.1 E F0
536(to logout.)4.703 F .536(This is useful)5.536 F .981
(if you sometimes accidentally type too man)147 175.2 R 3.481(yc)-.15 G
981(ontrol-d characters, logging yourself of)-3.481 F(f)-.25 E
(\(2.2\).)147 187.2 Q 51.94(input Man)72 202.8 R 3.522(yc)-.15 G 1.022
(ommands on)-3.522 F/F2 8/Times-Roman@0 SF(UNIX)3.522 E F0(tak)3.522 E
3.522(ei)-.1 G 1.021
(nformation from the terminal or from \214les which the)-3.522 F(y)-.15
E .433(then act on.)147 214.8 R .434(This information is called)5.433 F
F1(input)2.934 E F0 5.434(.C)1.666 G .434(ommands normally read for)
-5.434 F F1(input)2.934 E F0(from)4.6 E(their)147 226.8 Q F1(standar)
2.824 E 2.824(di)-.37 G(nput)-2.824 E F0 .324(which is, by def)4.49 F
323(ault, the terminal.)-.1 F(This)5.323 E F1(standar)2.823 E 2.823(di)
-.37 G(nput)-2.823 E F0 .323(can be redi-)4.489 F 1.211(rected from a \
\214le using a shell metanotation with the character `<'.)147 238.8 R
(Man)6.211 E 3.711(yc)-.15 G(ommands)-3.711 E .001
(will also read from a \214le speci\214ed as ar)147 250.8 R 2.5
(gument. Commands)-.18 F(placed in)2.5 E F1(pipelines)2.5 E F0
(will read)4.166 E .837(from the output of the pre)147 262.8 R .837
(vious command in the)-.25 F F1(pipeline)3.338 E F0 5.838(.T)1.666 G
838(he leftmost command in a)-5.838 F F1(pipeline)147 274.8 Q F0 .223
(reads from the terminal if you neither redirect its)4.389 F F1(input)
2.722 E F0 .222(nor gi)4.388 F .522 -.15(ve i)-.25 H 2.722(ta\214).15 G
222(lename to)-2.722 F 1.228(use as)147 286.8 R F1(standar)3.728 E
3.728(di)-.37 G(nput)-3.728 E F0 6.228(.S)1.666 G 1.229
(pecial mechanisms e)-6.228 F 1.229
(xist for supplying input to commands in)-.15 F
(shell scripts \(1.5, 3.8\).)147 298.8 Q 38.06(interrupt An)72 314.4 R
F1(interrupt)3.036 E F0 .536
(is a signal to a program that is generated by typing ^C. \(On older v)
4.702 F(ersions)-.15 E 1.098(of UNIX the)147 326.4 R F2 -.32(RU)3.598 G
(BOUT).32 E F0(or)3.598 E F2(DELETE)3.598 E F0 -.1(ke)3.598 G 3.598(yw)
-.05 G 1.098(ere used for this purpose.\))-3.598 F 1.099
(It causes most pro-)6.099 F .684(grams to stop e)147 338.4 R -.15(xe)
-.15 G 3.184(cution. Certain).15 F .683
(programs, such as the shell and the editors, handle an)3.184 F F1
(interrupt)147 350.4 Q F0 1.243(in special w)5.409 F 1.243
(ays, usually by stopping what the)-.1 F 3.744(ya)-.15 G 1.244
(re doing and prompting for)-3.744 F .808(another command.)147 362.4 R
808(While the shell is e)5.808 F -.15(xe)-.15 G .808
(cuting another command and w).15 F .807(aiting for it to)-.1 F 1.499
(\214nish, the shell does not listen to)147 374.4 R F1(interrupts.)3.999
E F0 1.499(The shell often w)5.665 F(ak)-.1 E 1.499(es up when you hit)
-.1 F F1(interrupt)147 386.4 Q F0(because man)4.166 E 2.5(yc)-.15 G
(ommands die when the)-2.5 E 2.5(yr)-.15 G(ecei)-2.5 E .3 -.15(ve a)-.25
H(n).15 E F1(interrupt)2.5 E F0(\(1.8, 3.9\).)4.166 E 59.72(job One)72
402 R .041(or more commands typed on the same input line separated by `\
|' or `;' characters are)2.541 F .62(run together and are called a)147
414 R F1(job)3.12 E F0 5.62(.S)1.666 G .62
(imple commands run by themselv)-5.62 F .621(es without an)-.15 F 3.121
(y`)-.15 G(|')-3.121 E .195(or `;' characters are the simplest)147 426 R
F1 1.86(jobs. J)2.694 F(obs)-.25 E F0 .194(are classi\214ed as)4.36 F F1
(for)2.694 E -.4(eg)-.37 G -.45(ro).4 G(und).45 E F0(,)1.666 E F1(bac)
2.694 E(kgr)-.2 E(ound)-.45 E F0 2.694(,o)1.666 G(r)-2.694 E F1
(suspended)147 438 Q F0(\(2.6\).)4.166 E(job control)72 453.6 Q .144
(The b)31.39 F .144(uiltin functions that control the e)-.2 F -.15(xe)
-.15 G .144(cution of jobs are called).15 F F1 .145(job contr)2.644 F
(ol)-.45 E F0(commands.)4.311 E(These are)147 465.6 Q F1(bg)2.5 E 2.5
(,f)-.1 G .2 -.1(g, s)-2.5 H(top, kill).1 E F0(\(2.6\).)4.166 E
(job number)72 481.2 Q 1.309
(When each job is started it is assigned a small number called a)29.17 F
F1 1.308(job number)3.808 F F0 1.308(which is)5.474 F .56(printed ne)147
493.2 R .561(xt to the job in the output of the)-.15 F F1(jobs)3.061 E
F0 3.061(command. This)4.727 F(number)3.061 E 3.061(,p)-.4 G .561
(receded by a)-3.061 F .023(`%' character)147 505.2 R 2.523(,c)-.4 G
022(an be used as an ar)-2.523 F .022(gument to)-.18 F F1 .022
(job contr)2.522 F(ol)-.45 E F0 .022(commands to indicate a speci\214c)
4.188 F(job \(2.6\).)147 517.2 Q 55.83(jobs The)72 532.8 R F1(jobs)2.63
E F0 .13(command prints a table sho)4.296 F .131
(wing jobs that are either running in the)-.25 F F1(bac)2.631 E(kgr)-.2
E(ound)-.45 E F0(or are)147 544.8 Q F1(suspended)2.5 E F0(\(2.6\).)4.166
E 59.16(kill A)72 560.4 R
(command which sends a signal to a job causing it to terminate \(2.6\).)
2.5 E 49.44(.login The)72 576 R(\214le)3.182 E F1(.lo)3.182 E(gin)-.1 E
F0 .682(in your)4.848 F F1(home)3.182 E F0 .681
(directory is read by the shell each time you login to)4.848 F F2(UNIX)
3.181 E F0 .291(and the commands there are e)147 588 R -.15(xe)-.15 G
2.791(cuted. There).15 F .292(are a number of commands which are use-)
2.791 F(fully placed here, especially)147 600 Q F1(set)2.5 E F0
(commands to the shell itself \(2.1\).)4.166 E(login shell)72 615.6 Q
304(The shell that is started on your terminal when you login is calle\
d your)33.05 F F1(lo)2.804 E .304(gin shell)-.1 F F0 5.304(.I)1.666 G
2.804(ti)-5.304 G(s)-2.804 E(dif)147 627.6 Q .769(ferent from other she\
lls which you may run \(e.g. on shell scripts\) in that it reads the)
-.25 F F1(.lo)147 639.6 Q(gin)-.1 E F0 .479
(\214le before reading commands from the terminal and it reads the)4.645
F F1(.lo)2.978 E(gout)-.1 E F0 .478(\214le after)4.644 F
(you logout \(2.1\).)147 651.6 Q 46.94(logout The)72 667.2 R F1(lo)2.741
E(gout)-.1 E F0 .241(command causes a login shell to e)4.407 F 2.742
(xit. Normally)-.15 F 2.742(,al)-.65 G .242(ogin shell will e)-2.742 F
242(xit when)-.15 F .901(you hit control-d generating an)147 679.2 R F1
(end)3.4 E F0(-)A F1(of)A F0(-)A F1(\214le)A(,)-.1 E F0 -.2(bu)5.066 G
3.4(ti).2 G 3.4(fy)-3.4 G .9(ou ha)-3.4 F 1.2 -.15(ve s)-.2 H(et).15 E
F1(ignor)3.4 E(eeof)-.37 E F0 .9(in you)5.066 F F1(.lo)3.4 E(gin)-.1 E
F0(\214le then this will not w)147 691.2 Q(ork and you must use)-.1 E F1
(lo)2.5 E(gout)-.1 E F0(to log of)4.166 E 2.5(ft)-.25 G(he)-2.5 E F2
(UNIX)2.5 E F0(system \(2.8\).)2.5 E 44.44(.logout When)72 706.8 R .324
(you log of)2.824 F 2.824(fo)-.25 G(f)-2.824 E F2(UNIX)2.824 E F0 .324
(the shell will e)2.824 F -.15(xe)-.15 G .325
(cute commands from the \214le).15 F F1(.lo)2.825 E(gout)-.1 E F0 .325
(in your)4.491 F F1(home)147 718.8 Q F0
(directory after it prints `logout'.)4.166 E EP
%%Page: 40 40
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-40 An)72 52 R
(Introduction to the C shell)2.5 E 61.39(lpr The)72 84 R(command)3.876 E
/F1 10/Times-Italic@0 SF(lpr)3.876 E F0 1.376
(is the line printer daemon.)5.542 F 1.375(The standard input of)6.376 F
F1(lpr)3.875 E F0 1.375(spooled and)5.541 F .038(printed on the)147 96 R
/F2 8/Times-Roman@0 SF(UNIX)2.539 E F0 .039(line printer)2.539 F 5.039
(.Y)-.55 G .039(ou can also gi)-6.139 F -.15(ve)-.25 G F1(lpr)2.689 E F0
2.539(al)4.205 G .039(ist of \214lenames as ar)-2.539 F .039(guments to)
-.18 F(be printed.)147 108 Q(It is most common to use)5 E F1(lpr)2.5 E
F0(as the last component of a)4.166 E F1(pipeline)2.5 E F0(\(2.3\).)
4.166 E 65.83(ls The)72 123.6 R F1(ls)2.532 E F0 .032
(\(list \214les\) command is one of the most commonly used)4.198 F F2
(UNIX)2.531 E F0 2.531(commands. W)2.531 F .031(ith no)-.4 F(ar)147
135.6 Q .249(gument \214lenames it prints the names of the \214les in t\
he current directory)-.18 F 5.25(.I)-.65 G 2.75(th)-5.25 G .25
(as a num-)-2.75 F 1.345(ber of useful)147 147.6 R F1<8d61>3.845 E(g)-.1
E F0(ar)5.511 E 1.344(guments, and can also be gi)-.18 F -.15(ve)-.25 G
3.844(nt).15 G 1.344(he names of directories as ar)-3.844 F(gu-)-.18 E(\
ments, in which case it lists the names of the \214les in these directo\
ries \(1.2\).)147 159.6 Q 54.72(mail The)72 175.2 R F1(mail)2.609 E F0
109(program is used to send and recei)4.275 F .41 -.15(ve m)-.25 H .11
(essages from other).15 F F2(UNIX)2.61 E F0 .11(users \(1.1, 2.1\),)2.61
F(whether the)147 187.2 Q 2.5(ya)-.15 G(re logged on or not.)-2.5 E(mak)
72 202.8 Q 53.44(eT)-.1 G(he)-53.44 E F1(mak)3.123 E(e)-.1 E F0 .623
(command is used to maintain one or more related \214les and to or)4.789
F -.05(ga)-.18 G .622(nize func-).05 F .076
(tions to be performed on these \214les.)147 214.8 R .077(In man)5.077 F
2.577(yw)-.15 G(ays)-2.677 E F1(mak)2.577 E(e)-.1 E F0 .077
(is easier to use, and more help-)4.243 F
(ful than shell command scripts \(3.2\).)147 226.8 Q(mak)72 242.4 Q
38.16(e\214le The)-.1 F(\214le containing commands for)2.5 E F1(mak)2.5
E(e)-.1 E F0(is called)4.166 E F1(mak)2.5 E(e\214le)-.1 E F0(or)4.166 E
F1(Mak)2.5 E(e\214le)-.1 E F0(\(3.2\).)4.166 E 43.06(manual The)72 258 R
F1(manual)2.529 E F0 .029(often referred to is the `)4.195 F F2(UNIX)A
F0 2.529(manual'. It)2.529 F .028(contains 8 numbered sections with)
2.529 F 2.98(ad)147 270 S .48(escription of each)-2.98 F F2(UNIX)2.98 E
F0 .481
(program \(section 1\), system call \(section 2\), subroutine \(sec-)
2.98 F .547(tion 3\), de)147 282 R .546
(vice \(section 4\), special data structure \(section 5\), g)-.25 F .546
(ame \(section 6\), miscella-)-.05 F 1.282(neous item \(section 7\) and\
system administration program \(section 8\).)147 294 R 1.283
(There are also)6.283 F .103
(supplementary documents \(tutorials and reference guides\) for indi)147
306 R .103(vidual programs which)-.25 F 2.557(require e)147 318 R 2.557
(xplanation in more detail.)-.15 F 2.557(An online v)7.557 F 2.557
(ersion of the)-.15 F F1(manual)5.057 E F0 2.557(is accessible)6.723 F
(through the)147 330 Q F1(man)2.5 E F0 2.5(command. Its)4.166 F
(documentation can be obtained online via)2.5 E(man man)183 348 Q .143
(If you can')147 366 R 2.643(td)-.18 G .142
(ecide what manual page to look in, try the)-2.643 F F1(apr)2.642 E
(opos)-.45 E F0 .142(\(1\) command.)1.666 F .142(The sup-)5.142 F
(plementary documents are in subdirectories of /usr/doc.)147 378 Q
(metacharacter)72 393.6 Q(Man)147 405.6 Q 3.489(yc)-.15 G .989
(haracters which are neither letters nor digits ha)-3.489 F 1.289 -.15
(ve s)-.2 H .99(pecial meaning either to the).15 F .457(shell or to)147
417.6 R F2(UNIX)2.957 E F0 5.457(.T)C .457(hese characters are called)
-5.457 F F1(metac)2.957 E(har)-.15 E(acter)-.15 E(s)-.1 E F0 5.456(.I)
1.666 G 2.956(fi)-5.456 G 2.956(ti)-2.956 G 2.956(sn)-2.956 G .456
(ecessary to place)-2.956 F .902(these characters in ar)147 429.6 R .903
(guments to commands without them ha)-.18 F .903
(ving their special meaning)-.2 F .34(then the)147 441.6 R 2.84(ym)-.15
G .34(ust be)-2.84 F F1(quoted)2.839 E F0 5.339(.A)1.666 G 2.839(ne)
-5.339 G .339(xample of a)-2.989 F F1(metac)2.839 E(har)-.15 E(acter)
-.15 E F0 .339(is the character `>' which is)4.505 F .535
(used to indicate placement of output into a \214le.)147 453.6 R -.15
(Fo)5.535 G 3.035(rt).15 G .535(he purposes of the)-3.035 F F1(history)
3.035 E F0(mecha-)4.701 E 1.115(nism, most unquoted)147 465.6 R F1
(metac)3.615 E(har)-.15 E(acter)-.15 E(s)-.1 E F0 1.115(form separate w)
5.281 F 1.115(ords \(1.4\).)-.1 F 1.115(The appendix to this)6.115 F
(user')147 477.6 Q 2.5(sm)-.55 G(anual lists the)-2.5 E F1(metac)2.5 E
(har)-.15 E(acter)-.15 E(s)-.1 E F0(in groups by their function.)4.166 E
48.61(mkdir The)72 493.2 R F1(mkdir)2.5 E F0
(command is used to create a ne)4.166 E 2.5(wd)-.25 G(irectory)-2.5 E(.)
-.65 E 38.61(modi\214er Substitutions)72 508.8 R 1.647(with the)4.147 F
F1(history)4.148 E F0 1.648(mechanism, k)5.814 F -.15(ey)-.1 G 1.648
(ed by the character `!').15 F 1.648(or of v)6.648 F(ariables)-.25 E
1.274(using the metacharacter `$', are often subjected to modi\214catio\
ns, indicated by placing)147 520.8 R 1.223
(the character `:' after the substitution and follo)147 532.8 R 1.224
(wing this with the)-.25 F F1(modi\214er)3.724 E F0 3.724(itself. The)
5.39 F F1 .493(command substitution)147 544.8 R F0 .493
(mechanism can also be used to perform modi\214cation in a similar)4.659
F -.1(wa)147 556.8 S 1.3 -.65(y, b).1 H
(ut this notation is less clear \(3.6\).).45 E 51.95(more The)72 572.4 R
(program)2.833 E F1(mor)2.833 E(e)-.37 E F0 .333
(writes a \214le on your terminal allo)4.499 F .334
(wing you to control ho)-.25 F 2.834(wm)-.25 G .334(uch te)-2.834 F(xt)
-.15 E .96(is displayed at a time.)147 584.4 R F1(Mor)5.96 E(e)-.37 E F0
96(can mo)5.126 F 1.26 -.15(ve t)-.15 H .959
(hrough the \214le screenful by screenful, line by).15 F .221
(line, search forw)147 596.4 R .221(ard for a string, or start ag)-.1 F
221(ain at the be)-.05 F .221(ginning of the \214le.)-.15 F .222
(It is generally)5.222 F(the easiest w)147 608.4 Q(ay of vie)-.1 E
(wing a \214le \(1.8\).)-.25 E 32.51(noclobber The)72 624 R .888
(shell has a v)3.388 F(ariable)-.25 E F1(noclobber)3.388 E F0 .887
(which may be set in the \214le)5.054 F F1(.lo)3.387 E(gin)-.1 E F0 .887
(to pre)5.053 F -.15(ve)-.25 G .887(nt acci-).15 F .219(dental destruct\
ion of \214les by the `>' output redirection metasyntax of the shell \(\
2.2, 2.5\).)147 636 R 44.72(noglob The)72 651.6 R 1.005(shell v)3.505 F
(ariable)-.25 E F1(no)3.505 E(glob)-.1 E F0 1.005
(is set to suppress the)5.171 F F1 1.004(\214lename e)3.504 F(xpansion)
-.2 E F0 1.004(of ar)5.17 F 1.004(guments con-)-.18 F
(taining the metacharacters `~', `*', `?', `[' and `]' \(3.6\).)147
663.6 Q 48.61(notify The)72 679.2 R F1(notify)2.811 E F0 .311
(command tells the shell to report on the termination of a speci\214c)
4.477 F F1(bac)2.811 E(kgr)-.2 E(ound)-.45 E(job)147 691.2 Q F0 .388
(at the e)4.554 F .388(xact time it occurs as opposed to w)-.15 F .388
(aiting until just before the ne)-.1 F .387(xt prompt to)-.15 F .853
(report the termination.)147 703.2 R(The)5.854 E F1(notify)3.354 E F0
-.25(va)5.02 G .854(riable, if set, causes the shell to al).25 F -.1(wa)
-.1 G .854(ys report the).1 F(termination of)147 715.2 Q F1(bac)2.5 E
(kgr)-.2 E(ound)-.45 E F0(jobs e)4.166 E(xactly when the)-.15 E 2.5(yo)
-.15 G(ccur \(2.6\).)-2.5 E EP
%%Page: 41 41
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-41)271.17 E 48.61
(onintr The)72 84 R/F1 10/Times-Italic@0 SF(onintr)3.562 E F0 1.062
(command is b)5.228 F 1.061
(uilt into the shell and is used to control the action of a shell)-.2 F
(command script when an)147 96 Q F1(interrupt)2.5 E F0(signal is recei)
4.166 E -.15(ve)-.25 G 2.5(d\().15 G(3.9\).)-2.5 E 46.94(output Man)72
111.6 R 2.878(yc)-.15 G .378(ommands in)-2.878 F/F2 8/Times-Roman@0 SF
(UNIX)2.878 E F0 .378(result in some lines of te)2.878 F .378
(xt which are called their)-.15 F F1(output.)2.879 E F0(This)4.545 E F1
(output)147 123.6 Q F0 1.418(is usually placed on what is kno)5.584 F
1.418(wn as the)-.25 F F1(standar)3.918 E 3.917(do)-.37 G(utput)-3.917 E
F0 1.417(which is normally)5.583 F .539(connected to the user')147 135.6
R 3.039(st)-.55 G 3.039(erminal. The)-3.039 F .539
(shell has a syntax using the metacharacter `>' for)3.039 F .152
(redirecting the)147 147.6 R F1(standar)2.652 E 2.652(do)-.37 G(utput)
-2.652 E F0 .152(of a command to a \214le \(1.3\).)4.318 F .152
(Using the)5.152 F F1(pipe)2.652 E F0(mechanism)4.318 E .713
(and the metacharacter `|' it is also possible for the)147 159.6 R F1
(standar)3.213 E 3.213(do)-.37 G(utput)-3.213 E F0 .713
(of one command to)4.879 F 1.058(become the)147 171.6 R F1(standar)3.558
E 3.558(di)-.37 G(nput)-3.558 E F0 1.058(of another command \(1.5\).)
5.224 F 1.058(Certain commands such as the)6.058 F 1.525
(line printer daemon)147 183.6 R F1(p)4.025 E F0 1.525
(do not place their results on the)5.691 F F1(standar)4.025 E 4.025(do)
-.37 G(utput)-4.025 E F0 -.2(bu)5.692 G 4.026(tr).2 G 1.526(ather in)
-4.026 F .087(more useful places such as on the line printer \(2.3\).)
147 195.6 R .086(Similarly the)5.087 F F1(write)2.586 E F0 .086
(command places)4.252 F 1.101(its output on another user')147 207.6 R
3.601(st)-.55 G 1.101(erminal rather than its)-3.601 F F1(standar)3.601
E 3.601(do)-.37 G(utput)-3.601 E F0 3.602(\(2.3\). Commands)5.268 F .398
(also ha)147 219.6 R .698 -.15(ve a)-.2 H F1(dia)3.048 E .397
(gnostic output)-.1 F F0 .397(where the)4.563 F 2.897(yw)-.15 G .397
(rite their error messages.)-2.897 F .397(Normally these go)5.397 F .679
(to the terminal e)147 231.6 R -.15(ve)-.25 G 3.179(ni).15 G 3.179(ft)
-3.179 G(he)-3.179 E F1(standar)3.179 E 3.179(do)-.37 G(utput)-3.179 E
F0 .679(has been sent to a \214le or another command,)4.845 F -.2(bu)147
243.6 S 3.439(ti).2 G 3.439(ti)-3.439 G 3.438(sp)-3.439 G .938
(ossible to direct error diagnostics along with)-3.438 F F1(standar)
3.438 E 3.438(do)-.37 G(utput)-3.438 E F0 .938(using a special)5.104 F
(metanotation \(2.5\).)147 255.6 Q 55.28(path The)72 271.2 R 2.161
(shell has a v)4.661 F(ariable)-.25 E F1(path)4.661 E F0 2.162(which gi)
6.327 F -.15(ve)-.25 G 4.662(st).15 G 2.162
(he names of the directories in which it)-4.662 F 1.035
(searches for the commands which it is gi)147 283.2 R -.15(ve)-.25 G
3.534(n. It).15 F(al)3.534 E -.1(wa)-.1 G 1.034
(ys checks \214rst to see if the com-).1 F .061(mand it is gi)147 295.2
R -.15(ve)-.25 G 2.561(ni).15 G 2.561(sb)-2.561 G .061
(uilt into the shell.)-2.761 F .062
(If it is, then it need not search for the command as)5.061 F 1.15
(it can do it internally)147 307.2 R 6.15(.I)-.65 G 3.65(ft)-6.15 G 1.15
(he command is not b)-3.65 F 1.15
(uiltin, then the shell searches for a \214le)-.2 F .845
(with the name gi)147 319.2 R -.15(ve)-.25 G 3.346(ni).15 G 3.346(ne)
-3.346 G .846(ach of the directories in the)-3.346 F F1(path)3.346 E F0
-.25(va)5.012 G .846(riable, left to right.).25 F(Since)5.846 E
(the normal de\214nition of the)147 331.2 Q F1(path)2.5 E F0 -.25(va)
4.166 G(riable is).25 E 5.28(path \(.)183 349.2 R
(/usr/ucb /bin /usr/bin\))2.5 E .173
(the shell normally looks in the current directory)147 367.2 R 2.673(,a)
-.65 G .173(nd then in the standard system directo-)-2.673 F .394
(ries `/usr/ucb', `/bin' and `/usr/bin' for the named command \(2.2\).)
147 379.2 R .395(If the command can-)5.395 F .672
(not be found the shell will print an error diagnostic.)147 391.2 R .672
(Scripts of shell commands will be)5.672 F -.15(exe)147 403.2 S .051
(cuted using another shell to interpret them if the).15 F 2.551(yh)-.15
G -2.25 -.2(av e)-2.551 H(`e)2.751 E -.15(xe)-.15 G .051
(cute' permission set.).15 F(This)5.051 E
(is normally true because a command of the form)147 415.2 Q
(chmod 755 script)183 433.2 Q -.1(wa)147 451.2 S 3.442(se).1 G -.15(xe)
-3.592 G .942(cuted to turn this e).15 F -.15(xe)-.15 G .941
(cute permission on \(3.3\).).15 F .941(If you add ne)5.941 F 3.441(wc)
-.25 G .941(ommands to a)-3.441 F(directory in the)147 463.2 Q F1(path)
2.5 E F0 2.5(,y)1.666 G(ou should issue the command)-2.5 E F1 -.37(re)
2.5 G(hash).37 E F0(\(2.2\).)4.166 E 33.62(pathname A)72 478.8 R 2.64
(list of names, separated by `/' characters, forms a)5.139 F F1
(pathname)5.14 E(.)-.15 E F0(Each)6.806 E F1(component,)5.14 E F0 1.123
(between successi)147 490.8 R 1.423 -.15(ve `)-.25 H 1.123
(/' characters, names a directory in which the ne).15 F(xt)-.15 E F1
(component)3.622 E F0(\214le)5.288 E(resides.)147 502.8 Q F1 -.8(Pa)
5.063 G(thnames).8 E F0 .063(which be)4.229 F .064
(gin with the character `/' are interpreted relati)-.15 F .364 -.15
(ve t)-.25 H 2.564(ot).15 G(he)-2.564 E F1 -.45(ro)2.564 G(ot).45 E F0
068(directory in the \214lesystem.)147 514.8 R(Other)5.068 E F1
(pathnames)2.568 E F0 .068(are interpreted relati)4.234 F .368 -.15
(ve t)-.25 H 2.568(ot).15 G .067(he current direc-)-2.568 F .619
(tory as reported by)147 526.8 R F1(pwd.)3.12 E F0 .62
(The last component of a)4.786 F F1(pathname)3.12 E F0 .62
(may name a directory)4.786 F 3.12(,b)-.65 G(ut)-3.32 E
(usually names a \214le.)147 538.8 Q 40.28(pipeline A)72 554.4 R .86
(group of commands which are connected together)3.36 F 3.359(,t)-.4 G
(he)-3.359 E F1(standar)3.359 E 3.359(do)-.37 G(utput)-3.359 E F0 .859
(of each con-)5.025 F .421(nected to the)147 566.4 R F1(standar)2.921 E
2.921(di)-.37 G(nput)-2.921 E F0 .421(of the ne)4.587 F .422
(xt, is called a)-.15 F F1(pipeline)2.922 E(.)-.15 E F0(The)4.588 E F1
(pipe)2.922 E F0 .422(mechanism used)4.588 F(to connect these commands \
is indicated by the shell metacharacter `|' \(1.5, 2.3\).)147 578.4 Q
52.5(popd The)72 594 R F1(popd)4.089 E F0 1.589
(command changes the shell')5.755 F(s)-.55 E F1 1.589(working dir)4.089
F(ectory)-.37 E F0 1.589(to the directory you most)5.755 F .001
(recently left using the)147 606 R F1(pushd)2.501 E F0 2.501
(command. It)4.167 F .001(returns to the directory without ha)2.501 F
001(ving to type)-.2 F(its name, for)147 618 Q
(getting the name of the current)-.18 E F1(working dir)2.5 E(ectory)-.37
E F0(before doing so \(2.7\).)4.166 E 56.39(port The)72 633.6 R 1.545(p\
art of a computer system to which each terminal is connected is called \
a)4.045 F F1(port)4.044 E F0(.)1.666 E .999
(Usually the system has a \214x)147 645.6 R .999(ed number of)-.15 F F1
(ports)3.499 E F0 3.499(,s)1.666 G .999
(ome of which are connected to tele-)-3.499 F .169(phone lines for dial\
-up access, and some of which are permanently wired directly to spe-)147
657.6 R(ci\214c terminals.)147 669.6 Q 64.17(pr The)72 685.2 R F1(pr)
3.152 E F0 .652(command is used to prepare listings of the contents of \
\214les with headers gi)4.818 F(ving)-.25 E
(the name of the \214le and the date and time at which the \214le w)147
697.2 Q(as last modi\214ed \(2.3\).)-.1 E(printen)72 712.8 Q 42.07(vT)
-.4 G(he)-42.07 E F1(printen)3.634 E(v)-.4 E F0 1.134
(command is used to print the current setting of v)5.3 F 1.133
(ariables in the en)-.25 F(viron-)-.4 E(ment \(2.8\).)147 724.8 Q EP
%%Page: 42 42
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-42 An)72 52 R
(Introduction to the C shell)2.5 E 42.51(process An)72 84 R .162
(instance of a running program is called a)2.661 F/F1 10/Times-Italic@0
SF(pr)2.662 E(ocess)-.45 E F0(\(2.6\).)4.328 E/F2 8/Times-Roman@0 SF
(UNIX)5.162 E F0 .162(assigns each)2.662 F F1(pr)2.662 E(ocess)-.45 E F0
(a)4.328 E .292(unique number when it is started \255 called the)147 96
R F1(pr)2.792 E .292(ocess number)-.45 F F0(.)1.666 E F1(Pr)5.292 E .292
(ocess number)-.45 F(s)-.1 E F0 .292(can be)4.458 F .692
(used to stop indi)147 108 R(vidual)-.25 E F1(pr)3.193 E(ocesses)-.45 E
F0 .693(using the)4.859 F F1(kill)3.193 E F0(or)4.859 E F1(stop)3.193 E
F0 .693(commands when the)4.859 F F1(pr)3.193 E(ocesses)-.45 E F0
(are part of a detached)147 120 Q F1(bac)2.5 E(kgr)-.2 E(ound)-.45 E F0
(job)4.166 E(.)-.4 E 38.62(program Usually)72 135.6 R(synon)3.532 E
1.032(ymous with)-.15 F F1(command)3.532 E F0 3.532(;ab)1.666 G 1.032
(inary \214le or shell command script which per)-3.532 F(-)-.2 E
(forms a useful function is often called a)147 147.6 Q F1(pr)2.5 E -.1
(og)-.45 G -.15(ra).1 G(m).15 E F0(.)1.666 E 43.61(prompt Man)72 163.2 R
3.503(yp)-.15 G 1.003(rograms will print a)-3.503 F F1(pr)3.503 E(ompt)
-.45 E F0 1.003(on the terminal when the)5.169 F 3.503(ye)-.15 G 1.003
(xpect input.)-3.653 F 1.004(Thus the)6.004 F .148(editor `e)147 175.2 R
2.648(x\()-.15 G .148(1\)' will print a `:' when it e)-2.648 F .148
(xpects input.)-.15 F .148(The shell)5.148 F F1(pr)2.648 E(ompts)-.45 E
F0 .147(for input with `%)4.314 F 2.985('a)147 187.2 S .485(nd occasion\
ally with `? ' when reading commands from the terminal \(1.1\).)-2.985 F
485(The shell)5.485 F .829(has a v)147 199.2 R(ariable)-.25 E F1(pr)
3.329 E(ompt)-.45 E F0 .829(which may be set to a dif)4.995 F .829
(ferent v)-.25 F .829(alue to change the shell')-.25 F 3.329(sm)-.55 G
(ain)-3.329 E F1(pr)147 211.2 Q(ompt)-.45 E F0 5(.T)1.666 G
(his is mostly used when deb)-5 E(ugging the shell \(2.8\).)-.2 E 48.61
(pushd The)72 226.8 R F1(pushd)3.048 E F0 .549
(command, which means `push directory', changes the shell')4.714 F(s)
-.55 E F1 .549(working dir)3.049 F(ec-)-.37 E(tory)147 238.8 Q F0 2.172
(and also remembers the current)6.338 F F1 2.171(working dir)4.672 F
(ectory)-.37 E F0 2.171(before the change is made,)6.337 F(allo)147
250.8 Q .442(wing you to return to the same directory via the)-.25 F F1
(popd)2.942 E F0 .442(command later without retyp-)4.608 F
(ing its name \(2.7\).)147 262.8 Q 63.61(ps The)72 278.4 R F1(ps)2.706 E
F0 .206(command is used to sho)4.372 F 2.705(wt)-.25 G .205
(he processes you are currently running.)-2.705 F .205(Each process)
5.205 F 2.512(is sho)147 290.4 R 2.512
(wn with its unique process number)-.25 F 5.012(,a)-.4 G 5.012(ni)-5.012
G 2.512(ndication of the terminal name it is)-5.012 F 1.754(attached to\
, an indication of the state of the process \(whether it is running, st\
opped,)147 302.4 R -2.3 -.15(aw a)147 314.4 T .715(iting some e).15 F
-.15(ve)-.25 G .716(nt \(sleeping\), and whether it is sw).15 F .716
(apped out\), and the amount of)-.1 F F2(CPU)3.216 E F0 .764
(time it has used so f)147 326.4 R(ar)-.1 E 5.764(.T)-.55 G .764
(he command is identi\214ed by printing some of the w)-5.764 F .763
(ords used)-.1 F .526(when it w)147 338.4 R .527(as in)-.1 F -.2(vo)-.4
G -.1(ke).2 G 3.027(d\().1 G 3.027(2.6\). Shells,)-3.027 F .527
(such as the)3.027 F F1(csh)3.027 E F0 .527(you use to run the)4.693 F
F1(ps)3.027 E F0 .527(command, are)4.693 F(not normally sho)147 350.4 Q
(wn in the output.)-.25 E 55.28(pwd The)72 366 R F1(pwd)2.8 E F0 .3
(command prints the full)4.466 F F1(pathname)2.8 E F0 .3(of the current)
4.466 F F1 .299(working dir)2.799 F(ectory)-.37 E F0 5.299(.T)1.666 G
(he)-5.299 E F1(dir)2.799 E(s)-.1 E F0 -.2(bu)147 378 S
(iltin command is usually a better and f).2 E(aster choice.)-.1 E 56.94
(quit The)72 393.6 R F1(quit)2.543 E F0 .043(signal, generated by a con\
trol-\\, is used to terminate programs which are beha)4.209 F(v-)-.2 E
(ing unreasonably)147 405.6 Q 5(.I)-.65 G 2.5(tn)-5 G
(ormally produces a core image \214le \(1.8\).)-2.5 E 34.72
(quotation The)72 421.2 R 1.489(process by which metacharacters are pre)
3.99 F -.15(ve)-.25 G 1.489(nted their special meaning, usually by).15 F
929(using the character `\264 in pairs, or by using the character `\\'\
, is referred to as)147 433.2 R F1(quotation)3.429 E F0(\(1.7\).)147
445.2 Q 29.18(redirection The)72 460.8 R .105
(routing of input or output from or to a \214le is kno)2.606 F .105
(wn as)-.25 F F1 -.37(re)2.605 G(dir).37 E(ection)-.37 E F0 .105
(of input or output)4.271 F(\(1.3\).)147 472.8 Q 46.4(rehash The)72
488.4 R F1 -.37(re)3.003 G(hash).37 E F0 .504
(command tells the shell to reb)4.669 F .504
(uild its internal table of which commands are)-.2 F 1.951
(found in which directories in your)147 500.4 R F1(path)4.45 E F0 6.95
(.T)1.666 G 1.95(his is necessary when a ne)-6.95 F 4.45(wp)-.25 G 1.95
(rogram is)-4.45 F(installed in one of these directories \(2.8\).)147
512.4 Q(relati)72 528 Q .3 -.15(ve p)-.25 H(athname).15 E(A)147 540 Q F1
(pathname)3.771 E F0 1.271(which does not be)5.437 F 1.271
(gin with a `/' is called a)-.15 F F1 -.37(re)3.771 G 1.271
(lative pathname).37 F F0 1.272(since it is)5.437 F(interpreted)147 552
Q F1 -.37(re)4.169 G(lative).37 E F0 1.669(to the current)5.835 F F1
1.669(working dir)4.169 F(ectory)-.37 E F0 6.668(.T)1.666 G 1.668
(he \214rst)-6.668 F F1(component)4.168 E F0 1.668(of such a)5.834 F F1
(pathname)147 564 Q F0 .187(refers to some \214le or directory in the)
4.352 F F1 .187(working dir)2.687 F(ectory)-.37 E F0 2.687(,a)1.666 G
187(nd subsequent)-2.687 F F1(com-)2.687 E(ponents)147 576 Q F0 1.001
(between `/' characters refer to directories belo)5.167 F 3.501(wt)-.25
G(he)-3.501 E F1 1(working dir)3.5 F(ectory)-.37 E F0(.)1.666 E F1 -.8
(Pa)6 G(th-).8 E(names)147 588 Q F0(that are not)4.166 E F1 -.37(re)2.5
G(lative).37 E F0(are called)4.166 E F1(absolute pathnames)2.5 E F0
(\(1.6\).)4.166 E 48.07(repeat The)72 603.6 R F1 -.37(re)2.5 G(peat).37
E F0(command iterates another command a speci\214ed number of times.)
4.166 E 56.39(root The)72 619.2 R .018(directory that is at the top of \
the entire directory structure is called the)2.518 F F1 -.45(ro)2.519 G
(ot).45 E F0(directory)4.185 E .998
(since it is the `root' of the entire tree structure of directories.)147
631.2 R .997(The name used in)5.997 F F1(path-)3.497 E(names)147 643.2 Q
F0 1.2(to indicate the)5.366 F F1 -.45(ro)3.7 G(ot).45 E F0 1.2(is `/'.)
5.366 F F1 -.8(Pa)6.2 G(thnames).8 E F0 1.201
(starting with `/' are said to be)5.366 F F1(absolute)3.701 E F0 .338
(since the)147 655.2 R 2.838(ys)-.15 G .338(tart at the)-2.838 F F1 -.45
(ro)2.838 G(ot).45 E F0(directory)4.504 E(.)-.65 E F1(Root)5.337 E F0
337(is also used as the part of a)4.503 F F1(pathname)2.837 E F0 .337
(that is)4.503 F(left after remo)147 667.2 Q(ving the)-.15 E F1 -.2(ex)
2.5 G(tension).2 E F0 5(.S)1.666 G(ee)-5 E F1(\214lename)2.5 E F0
(for a further e)4.166 E(xplanation \(1.6\).)-.15 E F2 -.32(RU)72 682.8
S(BOUT).32 E F0(The)42.432 E F2 -.32(RU)3.238 G(BOUT).32 E F0(or)3.238 E
F2(DELETE)3.238 E F0 -.1(ke)3.238 G 3.238(yi)-.05 G 3.238(so)-3.238 G
738(ften used to erase the pre)-3.238 F .739
(viously typed character; some)-.25 F .591(users prefer the)147 694.8 R
F2 -.28(BA)3.091 G(CKSP)-.04 E -.32(AC)-.736 G(E).32 E F0 .59
(for this purpose.)3.091 F .59(On older v)5.59 F .59(ersions of)-.15 F
F2(UNIX)3.09 E F0 .59(this k)3.09 F .89 -.15(ey s)-.1 H(erv).15 E(ed)
-.15 E(as the)147 706.8 Q F2(INTR)2.5 E F0(character)2.5 E(.)-.55 E EP
%%Page: 43 43
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R
(An Introduction to the C shell)72 52 Q(USD:4-43)271.17 E .632
(scratch \214le)72 84 R .632(Files whose names be)31.4 F .632
(gin with a `#' are referred to as)-.15 F/F1 10/Times-Italic@0 SF(scr)
3.132 E(atc)-.15 E 3.132<688c>-.15 G(les)-3.132 E F0 3.132(,s)1.666 G
632(ince the)-3.132 F 3.132(ya)-.15 G .632(re auto-)-3.132 F .196
(matically remo)147 96 R -.15(ve)-.15 G 2.696(db).15 G 2.696(yt)-2.696 G
195(he system after a couple of days of non-use, or more frequently if)
-2.696 F(disk space becomes tight \(1.3\).)147 108 Q 50.28
(script Sequences)72 123.6 R 1.257
(of shell commands placed in a \214le are called shell command)3.757 F
F1(scripts)3.758 E F0 6.258(.I)1.666 G 3.758(ti)-6.258 G(s)-3.758 E .105
(often possible to perform simple tasks using these)147 135.6 R F1
(scripts)2.605 E F0 .104(without writing a program in a)4.27 F
(language such as C, by using the shell to selecti)147 147.6 Q -.15(ve)
-.25 G(ly run other programs \(3.3, 3.10\).).15 E 61.39(set The)72 163.2
R -.2(bu)2.875 G(iltin).2 E F1(set)2.875 E F0 .375
(command is used to assign ne)4.541 F 2.875(wv)-.25 G .375
(alues to shell v)-3.125 F .376(ariables and to sho)-.25 F 2.876(wt)-.25
G(he)-2.876 E -.25(va)147 175.2 S .918(lues of the current v).25 F 3.418
(ariables. Man)-.25 F 3.418(ys)-.15 G .918(hell v)-3.418 F .918
(ariables ha)-.25 F 1.218 -.15(ve s)-.2 H .917
(pecial meaning to the shell).15 F 2.5(itself. Thus)147 187.2 R
(by using the)2.5 E F1(set)2.5 E F0(command the beha)4.166 E
(vior of the shell can be af)-.2 E(fected \(2.1\).)-.25 E(seten)72 202.8
Q 49.85(vV)-.4 G 1.228(ariables in the en)-50.96 F 1.228(vironment `en)
-.4 F 1.228(viron \(5\)' can be changed by using the)-.4 F F1(seten)
3.728 E(v)-.4 E F0 -.2(bu)5.394 G(iltin).2 E .013(command \(2.8\).)147
214.8 R(The)5.013 E F1(printen)2.513 E(v)-.4 E F0 .012
(command can be used to print the v)4.179 F .012(alue of the v)-.25 F
012(ariables in)-.25 F(the en)147 226.8 Q(vironment.)-.4 E 53.61
(shell A)72 242.4 R F1(shell)3.967 E F0 1.467
(is a command language interpreter)5.633 F 6.468(.I)-.55 G 3.968(ti)
-6.468 G 3.968(sp)-3.968 G 1.468(ossible to write and run your o)-3.968
F(wn)-.25 E F1(shell)147 254.4 Q F0 3.928(,a)1.666 G(s)-3.928 E F1
(shells)3.928 E F0 1.428(are no dif)5.594 F 1.428(ferent than an)-.25 F
3.928(yo)-.15 G 1.428(ther programs as f)-3.928 F 1.428
(ar as the system is con-)-.1 F 2.5(cerned. This)147 266.4 R
(manual deals with the details of one particular)2.5 E F1(shell)2.5 E F0
2.5(,c)1.666 G(alled)-2.5 E F1(csh.)2.5 E F0(shell script)72 282 Q(See)
31.39 E F1(script)2.5 E F0(\(3.3, 3.10\).)4.166 E 48.61(signal A)72
297.6 R F1(signal)4.085 E F0(in)5.751 E/F2 8/Times-Roman@0 SF(UNIX)4.085
E F0 1.586
(is a short message that is sent to a running program which causes)4.085
F .982(something to happen to that process.)147 309.6 R F1(Signals)5.981
E F0 .981(are sent either by typing special)5.147 F F1(contr)3.481 E(ol)
-.45 E F0(characters on the k)147 321.6 Q -.15(ey)-.1 G
(board or by using the).15 E F1(kill)2.5 E F0(or)4.166 E F1(stop)2.5 E
F0(commands \(1.8, 2.6\).)4.166 E 57.5(sort The)72 337.2 R F1(sort)3.23
E F0 .73(program sorts a sequence of lines in w)4.896 F .731
(ays that can be controlled by ar)-.1 F(gument)-.18 E F1<8d61>147 349.2
Q(gs)-.1 E F0(\(1.5\).)4.166 E 46.4(source The)72 364.8 R F1(sour)2.606
E(ce)-.37 E F0 .106
(command causes the shell to read commands from a speci\214ed \214le.)
4.272 F .105(It is most)5.105 F(useful for reading \214les such as)147
376.8 Q F1(.cshr)2.5 E(c)-.37 E F0(after changing them \(2.8\).)4.166 E
(special character)72 392.4 Q(See)147 404.4 Q F1(metac)2.5 E(har)-.15 E
(acter)-.15 E(s)-.1 E F0(and the appendix to this manual.)4.166 E 38.62
(standard W)72 420 R 3.033(er)-.8 G .533(efer often to the)-3.033 F F1
(standar)3.033 E 3.033(di)-.37 G(nput)-3.033 E F0(and)4.699 E F1
(standar)3.033 E 3.033(do)-.37 G(utput)-3.033 E F0 .533(of commands.)
4.699 F(See)5.533 E F1(input)3.033 E F0(and)4.699 E F1(output)147 432 Q
F0(\(1.3, 3.8\).)4.166 E 49.72(status A)72 447.6 R .621
(command normally returns a)3.121 F F1(status)3.121 E F0 .621
(when it \214nishes.)4.787 F .62(By con)5.62 F -.15(ve)-.4 G .62
(ntion a).15 F F1(status)3.12 E F0 .62(of zero)4.786 F .665
(indicates that the command succeeded.)147 459.6 R .666
(Commands may return non-zero)5.666 F F1(status)3.166 E F0 .666
(to indi-)4.832 F .051(cate that some abnormal e)147 471.6 R -.15(ve)
-.25 G .051(nt has occurred.).15 F .051(The shell v)5.051 F(ariable)-.25
E F1(status)2.55 E F0 .05(is set to the)4.216 F F1(status)2.55 E F0
(returned by the last command.)147 483.6 Q
(It is most useful in shell commmand scripts \(3.6\).)5 E 55.83
(stop The)72 499.2 R F1(stop)2.5 E F0(command causes a)4.166 E F1(bac)
2.5 E(kgr)-.2 E(ound)-.45 E F0(job to become)4.166 E F1(suspended)2.5 E
F0(\(2.6\).)4.166 E 49.72(string A)72 514.8 R .914
(sequential group of characters tak)3.414 F .914
(en together is called a)-.1 F F1(string)3.415 E F0(.)1.666 E F1
(Strings)5.915 E F0 .915(can contain)5.081 F(an)147 526.8 Q 2.5(yp)-.15
G(rintable characters \(2.2\).)-2.5 E 58.05(stty The)72 542.4 R F1(stty)
2.62 E F0 .12(program changes certain parameters inside)4.286 F F2(UNIX)
2.619 E F0 .119(which determine ho)2.619 F 2.619(wy)-.25 G .119(our ter)
-2.619 F(-)-.2 E(minal is handled.)147 554.4 Q
(See `stty \(1\)' for a complete description \(2.6\).)5 E 25.82
(substitution The)72 570 R .129(shell implements a number of)2.629 F F1
(substitutions)2.629 E F0 .13(where sequences indicated by metachar)
4.296 F(-)-.2 E .093(acters are replaced by other sequences.)147 582 R
093(Notable e)5.093 F .093(xamples of this are history)-.15 F F1
(substitution)2.592 E F0 -.1(ke)147 594 S .496
(yed by the metacharacter `!' and v)-.05 F(ariable)-.25 E F1
(substitution)2.996 E F0 .497(indicated by `$'.)4.663 F 2.097 -.8(We a)
5.497 H .497(lso refer).8 F(to)147 606 Q F1(substitutions)2.5 E F0(as)
4.166 E F1 -.2(ex)2.5 G(pansions).2 E F0(\(3.4\).)4.166 E 30.84
(suspended A)72 621.6 R .214(job becomes)2.714 F F1(suspended)2.714 E F0
214(after a)4.38 F F2(ST)2.714 E(OP)-.144 E F0 .214
(signal is sent to it, either by typing a)2.714 F F1(contr)2.713 E(ol)
-.45 E F0 .213(-z at)1.666 F .172(the terminal \(for)147 633.6 R F1(for)
2.672 E -.4(eg)-.37 G -.45(ro).4 G(und).45 E F0 .172
(jobs\) or by using the)4.338 F F1(stop)2.673 E F0 .173(command \(for)
4.339 F F1(bac)2.673 E(kgr)-.2 E(ound)-.45 E F0(jobs\).)4.339 E(When)147
645.6 Q F1(suspended)2.932 E F0 2.932(,aj)1.666 G .432
(ob temporarily stops running until it is restarted by either the)-2.932
F F1(fg)2.931 E F0(or)4.597 E F1(bg)147 657.6 Q F0(command \(2.6\).)
4.166 E 46.39(switch The)72 673.2 R F1(switc)2.584 E(h)-.15 E F0 .084
(command of the shell allo)4.25 F .084
(ws the shell to select one of a number of sequences)-.25 F .953
(of commands based on an ar)147 685.2 R .953(gument string.)-.18 F .953
(It is similar to the)5.953 F F1(switc)3.453 E(h)-.15 E F0 .953
(statement in the)5.119 F(language C \(3.7\).)147 697.2 Q 26.39
(termination When)72 712.8 R 3.228(ac)3.228 G .729
(ommand which is being e)-3.228 F -.15(xe)-.15 G .729
(cuted \214nishes we say it under).15 F(goes)-.18 E F1(termination)3.229
E F0(or)4.895 E F1(terminates.)147 724.8 Q F0 2.026
(Commands normally terminate when the)6.192 F 4.526(yr)-.15 G 2.026
(ead an)-4.526 F F1(end)4.526 E F0(-)A F1(of)A F0(-)A F1(\214le)A F0
2.025(from their)6.191 F EP
%%Page: 44 44
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R 268.67(USD:4-44 An)72 52 R
(Introduction to the C shell)2.5 E/F1 10/Times-Italic@0 SF(standar)147
84 Q 2.789(di)-.37 G(nput)-2.789 E F0 5.289(.I)1.666 G 2.789(ti)-5.289 G
2.789(sa)-2.789 G .289
(lso possible to terminate commands by sending them an)-2.789 F F1
(interrupt)2.79 E F0(or)147 96 Q F1(quit)2.5 E F0(signal \(1.8\).)4.166
E(The)5 E F1(kill)2.5 E F0(program terminates speci\214ed jobs \(2.6\).)
4.166 E 55.28(then The)72 111.6 R F1(then)3.922 E F0 1.422
(command is part of the shell')5.588 F 3.922(s`)-.55 G -1.95
(if-then-else-endif ')-3.922 F 1.422(control construct used in)3.922 F
(command scripts \(3.6\).)147 123.6 Q 54.72(time The)72 139.2 R F1(time)
3.1 E F0 .6(command can be used to measure the amount of)4.766 F/F2 8
/Times-Roman@0 SF(CPU)3.1 E F0 .601(and real time consumed)3.101 F .339
(by a speci\214ed command as well as the amount of disk i/o, memory uti\
lized, and number)147 151.2 R(of page f)147 163.2 Q(aults and sw)-.1 E
(aps tak)-.1 E(en by the command \(2.1, 2.8\).)-.1 E 58.61(tset The)72
178.8 R F1(tset)3.149 E F0 .65(program is used to set standard erase an\
d kill characters and to tell the system)4.815 F
(what kind of terminal you are using.)147 190.8 Q(It is often in)5 E -.2
(vo)-.4 G -.1(ke).2 G 2.5(di).1 G 2.5(na)-2.5 G F1(.lo)A(gin)-.1 E F0
(\214le \(2.1\).)4.166 E 61.94(tty The)72 206.4 R -.1(wo)3.07 G(rd).1 E
F1(tty)3.07 E F0 .57(is a historical abbre)4.736 F .569
(viation for `teletype' which is frequently used in)-.25 F F2(UNIX)3.069
E F0 .291(to indicate the)147 218.4 R F1(port)2.792 E F0 .292
(to which a gi)4.458 F -.15(ve)-.25 G 2.792(nt).15 G .292
(erminal is connected.)-2.792 F(The)5.292 E F1(tty)2.792 E F0 .292
(command will print)4.458 F(the name of the)147 230.4 Q F1(tty)2.5 E F0
(or)4.166 E F1(port)2.5 E F0
(to which your terminal is presently connected.)4.166 E 44.17
(unalias The)72 246 R F1(unalias)2.5 E F0(command remo)4.166 E -.15(ve)
-.15 G 2.5(sa).15 G(liases \(2.8\).)-2.5 E F2 53.008(UNIX UNIX)72 261.6
R F0 1.243(is an operating system on which)3.744 F F1(csh)3.743 E F0
(runs.)5.409 E F2(UNIX)6.243 E F0(pro)3.743 E 1.243(vides f)-.15 F 1.243
(acilities which allo)-.1 F(w)-.25 E F1(csh)147 273.6 Q F0 .285(to in)
4.451 F -.2(vo)-.4 G .485 -.1(ke o).2 H .285
(ther programs such as editors and te).1 F .286
(xt formatters which you may wish to)-.15 F(use.)147 285.6 Q 51.39
(unset The)72 301.2 R F1(unset)2.5 E F0(command remo)4.166 E -.15(ve)
-.15 G 2.5(st).15 G(he de\214nitions of shell v)-2.5 E
(ariables \(2.2, 2.8\).)-.25 E -.25(va)72 316.8 S(riable e).25 E
(xpansion)-.15 E(See)147 328.8 Q F1(variables)2.5 E F0(and)4.166 E F1
-.2(ex)2.5 G(pansion).2 E F0(\(2.2, 3.4\).)4.166 E -.25(va)72 344.4 S
(riables).25 E F1 -1.11(Va)39.15 G(riables)1.11 E F0(in)4.448 E F1(csh)
2.782 E F0 .282(hold one or more strings as v)4.448 F 2.781(alue. The)
-.25 F .281(most common use of)2.781 F F1(variables)2.781 E F0 .038
(is in controlling the beha)147 356.4 R .039(vior of the shell.)-.2 F
(See)5.039 E F1(path)2.539 E F0(,)1.666 E F1(noclobber)2.539 E F0 2.539
(,a)1.666 G(nd)-2.539 E F1(ignor)2.539 E(eeof)-.37 E F0 .039(for e)4.205
F(xam-)-.15 E(ples.)147 368.4 Q F1 -1.11(Va)6.233 G(riables)1.11 E F0
1.232(such as)5.399 F F1(ar)3.732 E(gv)-.37 E F0 1.232
(are also used in writing shell programs \(shell command)5.398 F
(scripts\) \(2.2\).)147 380.4 Q -.15(ve)72 396 S 41.55(rbose The).15 F
F1(verbose)2.621 E F0 .121(shell v)4.287 F .122
(ariable can be set to cause commands to be echoed after the)-.25 F
2.622(ya)-.15 G .122(re his-)-2.622 F .695(tory e)147 408 R 3.195
(xpanded. This)-.15 F .695(is often useful in deb)3.195 F .695
(ugging shell scripts.)-.2 F(The)5.695 E F1(verbose)3.195 E F0 -.25(va)
4.861 G .694(riable is).25 F(set by the shell')147 420 Q(s)-.55 E F1
<ad76>2.5 E F0(command line option \(3.10\).)4.166 E 60.84(wc The)72
435.6 R F1(wc)2.774 E F0 .274
(program calculates the number of characters, w)4.44 F .275
(ords, and lines in the \214les whose)-.1 F(names are gi)147 447.6 Q
-.15(ve)-.25 G 2.5(na).15 G 2.5(sa)-2.5 G -.18(rg)-2.5 G
(uments \(2.6\).).18 E 50.28(while The)72 463.2 R F1(while)2.5 E F0 -.2
(bu)4.166 G
(iltin control construct is used in shell command scripts \(3.7\).).2 E
-.1(wo)72 478.8 S 52.05(rd A).1 F 1.676
(sequence of characters which forms an ar)4.176 F 1.676
(gument to a command is called a)-.18 F F1(wor)4.176 E(d)-.37 E F0(.)
1.666 E(Man)147 490.8 Q 2.843(yc)-.15 G .343
(haracters which are neither letters, digits, `\255', `.)-2.843 F 2.844
('n)-.7 G .344(or `/' form)-2.844 F F1(wor)2.844 E(ds)-.37 E F0 .344
(all by them-)4.51 F(selv)147 502.8 Q 1.123(es e)-.15 F -.15(ve)-.25 G
3.623(ni).15 G 3.623(ft)-3.623 G(he)-3.623 E 3.623(ya)-.15 G 1.123
(re not surrounded by blanks.)-3.623 F(An)6.123 E 3.623(ys)-.15 G 1.123
(equence of characters may be)-3.623 F .6(made into a)147 514.8 R F1
(wor)3.1 E(d)-.37 E F0 .6(by surrounding it with `\264' characters e)
4.766 F .601(xcept for the characters `\264' and)-.15 F 1.078
(`!' which require special treatment \(1.1\).)147 526.8 R 1.077
(This process of placing special characters in)6.078 F F1(wor)147 538.8
Q(ds)-.37 E F0(without their special meaning is called)4.166 E F1
(quoting)2.5 E F0(.)1.666 E -.1(wo)72 554.4 S(rking directory).1 E 1.497
(At an)147 566.4 R 3.997(yg)-.15 G -2.15 -.25(iv e)-3.997 H 3.997(nt).25
G 1.497(ime you are in one particular directory)-3.997 F 3.997(,c)-.65 G
1.498(alled your)-3.997 F F1 1.498(working dir)3.998 F(ectory)-.37 E F0
(.)1.666 E .752(This directory')147 578.4 R 3.252(sn)-.55 G .752
(ame is printed by the)-3.252 F F1(pwd)3.252 E F0 .752
(command and the \214les listed by)4.918 F F1(ls)3.251 E F0 .751
(are the)4.917 F(ones in this directory)147 590.4 Q 5(.Y)-.65 G
(ou can change)-6.1 E F1(working dir)2.5 E(ectories)-.37 E F0(using)
4.166 E F1 -.15(ch)2.5 G(dir).15 E F0(.)1.666 E 51.95(write The)72 606 R
F1(write)4.224 E F0 1.725(command is an obsolete w)5.891 F 1.725
(ay of communicating with other users who are)-.1 F .781(logged in to)
147 618 R F2(UNIX)3.281 E F0 .781(\(you ha)3.281 F 1.081 -.15(ve t)-.2 H
3.281(ot).15 G(ak)-3.281 E 3.281(et)-.1 G .78(urns typing\).)-3.281 F
78(If you are both using display termi-)5.78 F(nals, use)147 630 Q F1
(talk)2.5 E F0(\(1\), which is much more pleasant.)A 531.38(-- --)0 795
R EP
%%Trailer
end
%%EOF