0707070000020017721006440000000000020000010430740365722212200000500000000004Size535 0707070000020031771006440000000000020000010430720367134560100000600000000237Files./Size ./Files ./Install ./Name ./MKflop ./ksh.README ./Remove ./ksh ./ksh.compat ./ksh.man ./ksh.memo ./ksh.release ./ksh.substring ./ksh.getopts ./suid_exec 0707070000020030031007550000000000020000010430710366370744600001000000001135Install# Install package for ksh # S.Coffin AT&T-ISL if [ ! -d $HOME/Filecabinet/ksh.docs ] ; then mkdir $HOME/Filecabinet/ksh.docs chmod +rwx $HOME/Filecabinet/ksh.docs fi echo "Installing ksh as /bin/ksh" mv ksh /bin/ksh chgrp bin /bin/ksh chown bin /bin/ksh chmod +rx /bin/ksh chmod go-w /bin/ksh mv suid_exec /etc chown root /etc/suid_exec chgrp root /etc/suid_exec chmod 4755 /etc/suid_exec mv ksh* $HOME/Filecabinet/ksh.docs echo "Installing ksh documents in the folder ksh.docs in your Filecabinet" echo "Please look at these materials, especially ksh.README" echo "Hit ENTER to continue." read DUMMY 0707070000020030051006440000000000020000010431060367132146400000500000000042NameKorn Shell (ksh) Version 6/3/86 0707070000020030071007770000000000020000010430750365722212200000700000000134MKflop# this one just creates the install format floppy.... cat Files | cpio -ocvB >/dev/rfp021 0707070000020030101006660000000000020000010430760367132202400001300000005020ksh.READMEHere are a few notes on use of the Korn Shell (ksh) on the AT&T UNIX PC 7300: (Release 6/3/86) 1) Several other items of ksh documentation will be left in your Filecabinet (in the DOCS/KSH folder) as a result of the install procedure. We recommend that you read this material if you wish to use ksh. These documents use a substantial amount of disk space, so you may wish to print them out and then delete the files. 2) If you use the ksh as /bin/ksh, then you will need to change the shell section in your Office Preferences to "/bin/ksh" so ksh is used when you create a UNIX window from the office. 3) If you use it as /bin/ksh, and log into bare UNIX (without the User Agent), as "root" for example, you will need to edit the /etc/passwd entry for that user to add "/bin/ksh" at the end of the line (after the ":" that ends the line). This will make ksh the login shell for that user. 4) If you use ksh as /bin/sh, be sure to save the the original /bin/sh as /bin/osh in case you need it later. Also, delete the rsh and link the new shell as /bin/rsh. These UNIX commands will do the job: mv /bin/sh /bin/osh mv /bin/ksh /bin/sh rm /bin/rsh ln /bin/sh /bin/rsh This will make the ksh the restricted shell as well as the normal shell. 5) This release of ksh should run as /bin/sh with no changes or problems with UNIX PC Release 3.0 and later. 6) The default alias file name for ksh is now .sh.aliases. This no longer conflicts with the UNIX PC Email-I Alias file name. 7) To use the history feature of ksh, you will need to add these lines to /etc/profile: HISTFILE=$HOME/.ksh.hist EDITOR=/usr/bin/vi FCEDIT=/usr/bin/vi export HISTFILE EDITOR FCEDIT These establish the history file name, and sets ksh to use "vi" editing commands. Consult the ksh documentation to use the emacs editing modes. The default history file name for ksh is now .sh.history. This no longer conflicts with the UNIX PC phone manager history file name. Note: the history file is NEVER truncated or deleted when you create a shell using the "UNIX System" entry in the Office. So, be sure that you add this additional line to /etc/profile: > $HISTFILE to assure that the history does not grow without bound. This line will empty the history file at each login. You can make other arrangements if you wish, but the history is no longer kept in ASCII form, so be careful. Consult the ksh documents for more tips on using command history. 8) ksh is a great improvement over the Bourne Shell and the csh. Try it! =S.Coffin 6/5/86 0707070000020030121007550000000000020000010431010366370752200000700000000455Remove/bin/rm -f /etc/suid_exec echo "You must remove the ksh manually from /bin/ksh or /bin/sh." echo "Also, be sure to restore the original /bin/sh and /bin/rsh," echo "and be sure to restore any changes you made to /etc/rc, /etc/profile," echo "and /etc/passwd." echo "Hit ENTER to continue." read DUMMY 0707070000020030131007550000020000020000010431020367133040400000400000261440kshR Z` ~ .textZ` .data  `@.bss   ~ OQ./HJf/H#  Nov/N Z>0<N@NVH<|$n&jtB# ( .S "b@0; NJ#FR br :p\ X z  rr|XB  g 9 g .~t/9 (N7,X`PL<|N^NuN 8Jlp`F N@NGp.N9./ NXp.N8./. NX# *`p-@ .N{ @# ,f.V/9 (N7,X$| (YR &|4Bp# .`$B.z/ NPXXS Jg6&j g. -f(+HH-@g. `/ N N|XJgp . 9 .N W# . @@gp-@ g6NB(J 2f.}/9 (N7,X y 2(P `~g (y  f^.}x/9 (N7,X`H g< 9 .Ѐ"瀐"| I, HH@f./9 (N7,X`(y , .N.A//.N5PJg(f"Sm lRr `.p /N RX gNI`  l./9 (N7,XS gX.N .xJfp`p# *`t`tp--@`rt gHH`p-@B . -g +f.4/ NTX$Xg g.}/9 (N7,XJ g-|B f0 g.}/9 (N7,X-y 6-|`:g, g.}/9 (N7,X-y :pĀ`-y >g&-y f.}x/9 (N7,X`-y .NJf(Jg p././`J./<|N @X`$Jg`p./ NX` +fp`p././/.` f -y 6`0 g$ -fp./ NX$XS -y :`-y >  l./9 (N7,X` nر >fV,g4p]./ N NdX @&H g+HH"|4~1g l0,g./, N7,X.N D` g .N @(H f .x/ `  o A.N./NX`HnN QX. Np ./.N.Xp ./.N.Xp ./.N.Xp ./.N.X`nJ Bg, g .N H` 9 F# *p./9 BN MXN 8Jm.  g .N H` 9 F.N7`J gp# #  g.N H#  9 ʰ o#  ` 9 D# `J gp# #  g.N H#  9 ʰ or#  `d gB-KHH"|4~1f X -f R` ./ N7,X` . Ntp!n "| JJg(p:./N\Xp . "| J/1NXR`*|9 g.~t`  o./9 (N7,X  f(Hn/*/ p/N{X @/N`2 gJf y AZ` -fJ+f y AV.N F @&H gJf(  f |~T` |./9 (N7,X /g y A .N F @*H f*| .fI .fRJg /f*|(M./ N :g89 g.p/./ N NdX @ g. Np ./ NXp.N{ @-H. y AV/N 4X /f.HnN X`"Hn/.NP @(H/./ NXG.N 7. y AH/N 4X./<X&pn 9 g . A"剑.N p  Jg.N@ f nJ fp./9 >//9 N ` gA./ `"p-@BBBBBB .NB((y 2 f.}/9 (N7,X`./ N vX$f4R .CA", .S B . fF`VgX-jf.}/9 (N7,XgR gRgRX&j g -gh$.plP&j gHHH"|4~1f -gJf$p=.A/N NdX @ g -K`JlJg* ,r$pl$-BtJfJg ,S` ,U` .-@ , -@np-@t`L C 1m$Jfp`p( C 1",m.}/9 (N7,XRpmJg( n -f .g.}/9 (N7,Xp-@Jnp$ C*1pC 1lp-@Jg-y &| e`HnNVX @-H&| hR.NJfp . C/1N\`.Jg* nSm n"hRp `.p /N RX.p/ C/1NLX/NLX @(H g* @g -f` +f F`R *` .Ȁ./ N|X @(HJg" g -fp.N``Jf -gp=./ N NdX @ fjJf$.N F @ g .N|`R *`p./ NXJf./ NYXp ./<NXR *`-T -fT .Ā&g?`" gpƀg` g` g` F&Jg\J .n .İgJ. .// N -P`4S gvX&R./ N>X @(H fp# *`X&R gF.N$p!nJmJg .N@` "| J.N#b.N @(H "| J# nJg .N@R`.N@`RHH"|4~1fJf<&jR.N H& C# -f CA",SӐX`p.p/ ,S//*NM@ -@R CA2.H l.x/*N7,X`HH&g$p0mp7o.}/9 (N7,X`.N Y`NVH t nE`  "| RHH&gJ |4~08g 9 .Ѐ"Ё"0Ё# .`./< N NdX @&H f`  f L N^Nu.}/9 (N7,X`NVH $n&n HnNRX gHn/ NR8P-K` g.NRHn/ N KPR p.p /N$X @-HS 9 fp  fJ 2gNIp.NRp ./.NXL N^NuNVH$nHH"|4~1g .N H$`./ NX$S LN^NuNVlHt"$|. N` Cp#Sl RJg$* Cp#P`t!S Cp g RCpBHnx S/N8PLN^NuNVH&n &9 B../N N|XJfp`p-@X$S gVHH$p-gp+f@p-fp`p@SRHH$fw`p-fJg X9 gJg0 o .S./ `.  y A/N ?rXg9 f./9 N 42X#  .LN^NuR`./< N NdX @ g.} n /(N7,Xpcf,J.g& mJ fX# S`./< jN NdX @(H g  j"| |(1`Zpog.} n /(`:XJf .NY`RS.2/NX$p(pag.}/N7,XJ.g g` FƀHH$g Jgpsf`NVH $| j&| @`  j"| | 1 gRJfB | @ L N^NuNVH $nt&` .N VԀ&Z f n" &p./9 X @$H` f`B-|BBp.N @$H%KJ g 9 ` y  ( S%@KJ f(y  B 9 &g"p./ NbX(-L &`fB &p./ N:X,fp-@Jm$ .RJf.A /NX-@**L 9 -@# &N͸ fJf ( fN͸ ) f#  -y -y ܙ-y  p.N @$Hp$p%@ y #  0 fN y  A %HN.N p.N" 9 g:NB(J 2g, y 2(P .NL"lA %@ p./<(NX @-Hp.N" -y  y #  n %n y  g#    g.fNINHp # R N͸p./ NX @&H gp-@.p/N~X @$H%K gp$`p(# J. gx g$`&k J fp./NX @'H `Pp./NX @&H%K`6B .@$Jo./ NX @%H` Jg%n  &`&NV` p.NxR N͸r g 9 N^NuNVH $9 . 9  g fJ .fBB > fB@`<B# L`,Nt&p&fB`p>fB` @# Npp.N @$H y  A %H$g%y # N͸p./.N$X @%H J g ( J L N^Nu n`NVN͸JgNXN^NuNVH $.  &g `  gN$L N^NuNVH$.g"$|:`PJg *f. /` f. /<6NY` g8 y Sm y "hR `.  2/N RXp f. /< ` y Sm y "hR `.  2/N RX y Sm y "hRp'LN^Nu. p'/N RX`NVH$|B$9 . Np./<}NX9 f*. /<NYXp . y /(N\Xp`./<0NXJg.Nf`p'. y  A /NX g g$|Np ./ NXNIp.N7LN^NuNVH $nB*vB.A -H`jCR`^ |3~0(g8p$gp`fCp`f8R `0J.f* nJfp[gC`p"fp.@C nRHH$g p\f`|J fpƀJfL N^Nug* `gpg|`B.I &L`>p\f&HH$J.g |3~0(f p"g\ ` p.@HH$gp"g`B`hNVH . .N @(HE )n  n&h`A $&S fB L LN^Nu  @  ""@@@@@@@@@@@@@@@@@@@@@@@@@@ 00112233445566778899aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZNVH$n n X &P gB`HH$ \fJfRHH 0gr \gd bg8 cg6 fg: ng6 rg2 tg. vfVt `Rt`LpLN^Nut `:t `6t `2t `.t\`*tI`HHr0Rd 0m 7oSSm jR"`. 2/N RXRJf n Jg"Sm jRr `.p /N RX9 g.N7`p` y Sm y "hRp `. p /N RXp ./ NXp.N L N^NuNVHp $# *gp./9 BN MXp „  g# p.NLN^Nu f8N y  P. y /N KXNNp.N[p# # B B NIp8 „By P# p./9 BN MX`hNVH $.&9 *$y J gB J./ NX`p NAp.N 9 g$ y J f y  P( HH.Nמ9 g . N=Npg9 gN IrfN $Jg&./N OvX.N V/N M4XN L.N Z>L N^NuNVH$y  `.N Y.N#b$jb#  LN^NuNVH<B.B.BBBp-@-y A-H9 f &n$K nB(tB`~S`RR`nJg8 *gT /g> ?gB [g6 \g ]f6Jg2`:|/J gJg`"Rt`R` . oHH`f$|` #/ff $| BJgg.Nb @$H.NlJ.gf/N OvXp f .N#pfj9 gJ o9 g ɑ./<}LN7,X` p<.N Lp ./<},NXN`f "| JJgp`p& 9  | P"0(pn2 `&NVH $|``&* $S | P"(p`f,.NnJf"g |>f` |8./N OvX` pf.N

f/N OvXLN^NuNVHt"`& "| J$q gJg.N$ | PB0( SJfB9 LN^NuNVH$. "| JJg .N#b "| JB | P0(g80(g.>f` | P0(g$./N OvX | P0(LN^Nu.8`NVHt"9 9 g9 f$J *gxJ g q9 g\. *N7`N | P0(g@0( "| J$q g(-y *./ NX# *# * SfLN^NuNVH<tJ 2g L<N^Nu y A.N F @(H fNJ Zf J9 VfHn y AZ/N FX @/NP @*H./< NXIB.`.N Q.N Yt. p // N XZP/NSpX @$H f2.NWB @$H g>./ NW~X @$H./ N HVX`p.p/* HH/N XHP$Jg .NJfl fHnNVX @$H gp./ NTX @$H y A.N F @*H g.N .x-@`-|p` 9 rn 9 rЀ# r`S r 9 r.N! @&H f.N Qp`F# 2&'n .N! @./ N KXp'@Bp'@'@JfPSm jR<`./<N RXSm jRr`.p/N RX.N RJg^-n -@ ../ N4X'@-@NH ."+А-@ oJnJ.g HnN YXJ9 VgT oJ cB. p// N XZP/NSpX @-Hg.N Y +./.NXp`NVH$np./ N KXp.// N J:PSm jRp`.N\ g pLN^NuSm jRp`.N\# vp`NVH$n(y 2 T./ N KXp./N KXB 2NJ 2gN-y 2 y 2&P# 2R p./. NX// N J:P# 2` kR"` LN^NuSm jRp`.N\$pg JgSl. 2/N RX` Npfd.N Q.N#b.N#b`NVH$ntvJ op./. / N J:P`TvSm jRp`.N\(pgpf LN^NuJo>pfJ vgJftJ vg Є`pl r„Ё$R`Jf f y 2". ҂\!Av`fJfp`p&R`Tp.p// N J:P y 2r!Ap`\NVJ 2g y 2.N QN^NuNVH<$y 2v(**BR z.//N J:P`fx``Jf, f Jfp-@ת * rC#`Jf& fJ vfp-@v` fv`v( RSm R"hRp`.N\$pgR .SJon`dB%EB zLRp fRnJg nHHf Jl-nHHfR`Jf=n`0Jg JgpfN . fp.p//N J:P .L N^NuNVH $n&y 2vI f pL N^Nu. N"-@p././N J:P` gJm .f eB"`F  SSm S"hRp`.N\$g pgp f Rg Jm` g&*HH$p fSBp.p//N J:P `HNVH $nvJ 2f y b L N^Nup. y 2 (S//.NP`6 |3~0(HHr$gJg BS gv`Jf Jf-JRRHH$fB n`NVH$.&. ֮J 2ft`zJnd y 2 ("H (JlZSmp.//N>Pր`t =@ .LN^Nup.//NP(nR y 2n` =@`NVH $nNB @&HR =f n Sm n "hRp` . N\$pg `.Nx @-H. N QBNB @&H./ /./.N @ gX.N VA.Nx|= y 2./ NYXN. / NYX./ NXL N^Nu.~T/.N7,X`NVH. /.NX @$H.# B ~ LN^NuNVH$y $Bp%@LN^NuNVH&n$n (y (| %K K%H| $p)@ fp`p* * HHrLN^NuNVH$n%y  B# LN^NuNVH $.$y J gB&R+ HH&JfJopgpg g.N# pL N^Nup`NVH$| NJg*p. D/* HH/N XHP./ N KXLN^NuNVH $.$n Jm> Ѐ"瀐"| GB @ BHH ag& rg wg( L N^Nu `p.p//N XHP *+f + + K`NVHnN KXJm JmJl./<~N7,X. /.N(X @"n". /.NX @"n#HN^NuNVH$nJg.N QJg .N QLN^NuNVH $n. p// N XZP/NX @&H f.~/ N7,X K L N^NuNVH $. &xpoJfx Ѐ"瀐"| E n( HHg&Jfp.p//N KP(J* g.N``.N WV.p/ n( HH/N KP-@Jl./<N7,X n( HH&g&| ` n( g | ` | &H.N Q./N|X @$H @ f. ^` y f* f. f/ N KX` n$ n%h n%h./.N KXJf  pf.p//N KP J L N^NuNVH$nt &| 9 gN V.N @.NR ~. /9 ~NX @/NX.NR @(H f SJf g../ NX./ NfX @(H f.~f/ N7,X L LN^NuNVH.  /</.N I@P/NX @$H J LN^NuNVH $n&n g(.N Q.  p// N XZP/NX @&H K L N^NuNVH$n.N#b.N Q./ N KXLN^NuNVH t &n g -@&.N-k.N@Jgp.NB @(H. Nb @'HHn/ N KP'y  #  NB @-HJg`R n  g nR$H nB  fgTp`fJ f p.N` p"f6J9 f BR9 y N$ |3~0(HHrA€f `4p$f`B.p -@ y A6.N F @&H gJfR.` HH-@JfJ9 g y R \ y R B`f y ڱ e .N#J9 f"p\fJ9 fJ.g |3~0(g y R \ y R "HH$fJgR .మlJo ."y $q`. lRP.N F @$H f lRP .RJf gJ9 g" n *fJ.f y R \ y R `NVH 9 9  HnNRXHn/.NR8PNBB9 B9 p.Np.NRJ9 g, y ֱ f y R \ y R B  . Nx @ L N^NuNVH -y  -|-y . Nx @-Hp -@vJ g . N RNBJgzp.p)/p(//9 N @A# ``p\f4N$ |3~0(fp"fJ9 f y R \ y R "N$p`gJf. Nx @(Hp HnNRXHn/ NR8PB R p./<N$X @&HS $J fxJfppfh r c\-y 9 fJHnNVX @$Hp./ NTX @$H J ZgHnN YX` `$| # .N Sm jRr`.p/N RXp .// NPSm jRr`.p/N RX J9 ^g&.N Rp.p// N J:P.NRv`B./ N KX. _HnN XX. ^/ N KXE.HnNR8X# `Jf8Jf2 kJfp./(NX @(H`(|.NT @$H`xR y  g./.N$"X @&HHnNT X# J FRy PHnԑ/p // NBy P$n.N QHn/ N KP.NR.N .$` y R "nR SJfN$g8J9 fp\fJ9 g y R \ y R "`Jo>p./9 fN (X`*p  y   gѹ `J9 gS  y ֱ fJmp.NR . L N^Nup`NVH $n 9 &B9 # HnNRX.NRHn/.N KPHn/ N KPJg . NNB`, y "hR`. 0/N RXp".N\ \f,NHH"|3~1f y R \ y ڱ g4B./9 NYXJg. /9 NYX#  JgSmN jR`Tp.NRB .N Rp.// N J:P./ N KXL N^Nu.0/N RXJg y Sm`NVH $n . #g( %g^ #g %gL J L N^Nu&JRHH$B. /.N Xrf y E # .Nl J LN^NuNVH$nR . N MJfp./ NrX @$HB  J LN^NuNVJ gp./< N MX./<~TN7,XN^NuNVH $n t#  . N# N I$# ZN H# N H|# . N QN?^B p.N" NzN4$.N6 @&H -f R VJo. / N X#  .A"9 S 剑#   l  9 @ f S X  9 Z fN H g./9 N 42X 9 g tp . N M y # . vN V# /NX @/NX. N KN I# . vNQ9 R9 Jf9 fp`p-@ 9 @f.9 g$p.N W~Jgp.N W~Jg   fR9 V 9 VmT9 V.N @"y "g.N y .N QJgD.Nn @.N @"y "g".NX  y .N Qp.N P @ g y KJg. y A.N F @&H g.Nn @&HJf `&| g6.N @"y "g".N  y .N QJf J gHn/9 NR8P`$&y # 9 g y  `./ N Jg` | f./ N KX9 gd y Jf,J g |` |. y A/N 42X p.N@NB(J 2g: `0Jg `  p p &y 2. N MJgJg.N QL N^Nu#  Bp# # # B B  g.NR* g`>NG`J o p.N L9 g6 g2NH SSm S"hR `.p9 /N RXp  p p.p /N$X @-H gNIJgXJ g y E # `LN^NuJgf0.԰y f0.Ұy f .హ o@-y b# bp . f |}`A/NnX @/NX# bA"| """""""2` f g?$KJf.N`HNVH $nN. N&J`p!fDRHH$p!g0p.J 2g y 2 (`Ry 09 H/N\XJg y Sm* y "hR `0 y  hBL N^Nu.  2/N RXRHH$g`ZNVHt` RJo LN^Nu y AZ.N F @$H g4 /f..arithmetic expression ending in single ')' at line /dev/null+ # $ ${HOME:-.}/.profile/etc/profile/etc/suid_profile/etc/suid_exec/dev/fd/??/.sh_historyunlimitedtestkillsetletread.function basePWD=`/bin/pwd 2>/dev/null` realusersys ! $(,5>EMT]aels{  b   "*08CGTW_dns}! ""0+. 188$=<BHNP(RW [ _c@"g@l pt x|@ 0 0   0   & -2>I V fq    $,/5<> @BHN QZ_d ipux"}#   C F EHGD !$ (*1:AFO(X`j s|@PATHPS1PS2> IFSPWDHOMEMAILREPLYSHELL/bin/shEDITOR/bin/edMAILCHECKRANDOMENVHISTFILEHISTSIZEFCEDIT/bin/edCDPATHMAILPATHPS3#? OLDPWDVISUALCOLUMNSLINESPPID_TMOUTSECONDScat/bin/catchmod/bin/chmodcc/bin/cccp/bin/cpdate/bin/dateed/bin/edfalselet 0functionstypeset -fgrep/bin/grephashalias -thistoryfc -lintegertypeset -ilpr/usr/bin/lprls/bin/lsmake/bin/makemail/bin/mailmv/bin/mvnohupnohup pr/bin/prrfc -e -rm/bin/rmsed/bin/sedsh/bin/shtrue:typewhence -vvi/usr/bin/viwho/bin/whocasedodoneelifelseesacfiforfunctionifinselectthentimeuntilwhile{}ALRMBUSCLDEMTERREXITFPEHUPILLINTIOTKILLPHONEPIPEPWRQUITSEGVSYSTERMTRAPUSR1USR2WINDAlarm callBus errorDeath of ChildEMT trapFloating exceptionHangupIllegal instructionInterruptabortKilledQuitBroken PipePower failMemory faultBad system callTerminatedTrace/BPT trapUser signal 1User signal 2allexportbgniceemacserrexitgmacsignoreeofinteractivekeywordmarkdirsmonitornoexecnoglobnounsetprotectedrestrictedtrackallverbosevivirawxtrace.:[aliasbreakcdcontinueechoexecexitexportevalfcjobskillletloginnewgrpprintpwdreadreadonlyreturnsetshifttesttimestraptypesetulimitumaskunaliasunsetwaitwhence!=-a-ef-eq-ge-gt-le-lt-ne-nt-o-ot=exportreadonlytaggedlongunsignedfunctionintegerlowercasezerofillleftjustrightjustuppercaseNVH $n g@HH$g6&n SHH&g&n"f"./ N N|XJf +L N^Nup`P`NVH $n$. 9 gfB`^*gp.A /NnX @&H`G ./ NBX$R9 g". N gp `p ./ NX fL N^NuNVH $nHH$ |4~0(HHrQ€f:.g |3~0(HHr€g./.N7,X L N^NuRHH$ |4~0(HHrY€fp[f.N ; @EHH$gp=g./.N7,XB.g*p./9 6/.N 9P @&H @g6`..gp./9 >/.N 9P` .N 3 @&H p=fP g y Aطg y AfR9 g.~t/.N7,X y Af(.N6 @-Hpr./N NdX @ gB ./ N 42X .  f$./</9 6/<N @ y Ahg y Afx y Jlfj.N6 @$H. ,/ N Jf.N! @./. N KX.NR. NR`BJgJfJ.gJf< y ڱ c.p  y HH./.N NdX @ fR  y B y ./ N 42X y # 9 gJg .N 3 @`&HJ.fp-@`D./ N 42X9 gJg.N 3 @` y R "JgN`Nt$./.N NdX @ gp`p-@ |3~0( @JgJgJ.f./<N NdX @ g`&H f: nʱ g p.NR9 gNI p  L N^NuNVH $n g0.N VR.N! @&H./ NX K L N^Nu`NVH$n$. A-H9 g .N7&y   g  f./<>NYX./* NYXJf2 jJm*./<NYX. 6p/ j/NL/<zN @ 9 "T.N @$HX# &p.p//9 >/<N @ y &X &B J LN^NuNVH.N! @# p.//<zNP @# ># * y !|( y !|(p.Nb y !| y r!A y !|  y !|.N! @$Hp./ /<ZN(P @# 6p .N <" @# :LN^NuNVH.N <" @$H&n (n`T'H 'lBJg" .@-@Jg l /f&7| ./ N @XP TJf J LN^NuNVH $y >p.N <" @&H&# >./.NXB# >./<FN AX&# >L N^NuNVH $n. >/* NX @&H g+g pL N^NuNVH$y ># >f # * >./<N AX.N#bLN^NuNV`N y >JfN^NuNVH $n. >/* N@X @&H g+g pp.N.N#bL N^NuNVH<$nK @f&*g((Up0,$`( r @.N @P`L<N^Nu.N DB`JmD SC&q g fKJg @f+g U P` U.N#b`.N#bB`NVH$n y >Jg( r.N MH"|z.N 3 @$H.N F @ LN^NuNVH &n `p./ /.N 9P @$H&S g g gJf L N^Nu J J`NVH$. `Jg. / NYX.:/ NXJgJgF$|`/ N7,X."/ N7,X.4/ N7,Xp./ N|~XJf #F 2 L LN^NuNVH $n&n B B B B NN '. y  PJ( g y .N QN#  . f/< N KXp./ N XZX$m(Hn/N WjPJfp0.@ g.N WVN H& ZgN V.N @./< AN XX.@/< 8N I@X$mn. 8N YHn/N WjPJmNp0.ְfDp g".N WVp .p//N KP.N WV-c&. 6/ /<N OTPp./ N XZX$l.~/ N7,X&p .N WV. Q/NSpX @"y "p.p//9 >/<8N @ p.p//9 6/<8N @ p.p//9 :/<8N @ y (9f. y A6/N 42X.Np./< N MXL N^NuNVH $n $.-y BB-y J-y A"| p% Q B  gJ.Ng  `  # B Hn/ NJP @-HA# BHnN MX-@f<  9 R  cp./9 BN M` ./.NXS # B g$N./.NX# B9 -y A"| r%"Q" n gp.NRJf f*J f.}h/N7,`p./9 BN MX g0&y J g& ng# J./ NX.N#bL N^NuNVp ./.N F X @ N^NuNVH$nB&nJg4(n Jf:`L`4Jg"-J`fRJfJg.$n(n Jf LN^NuJg ngg`./.NX @&H./ NX n`NVH$n-J` /fJg-JJf n LN^NuNVH $n g&&J`p\fHH$Jg HH$fBL N^NuNVH $n&n JfS K L N^NuNVH nA r$$y չ #   y ڱ e   @A .N# J LN^NuNV 9   l .N# y #  N^NuNVH $nB&y A r @# #  K L N^NuNVH$n`.N#b y #  y b c J` y # #  y  c.N9LN^NuNVH$< 9   @A ԀJo D.N#LN^NuNVN @./.NX @.N @ N^NuNVH$. n $P# Bp# : [f4J*f.S "n $q ]fJ*g.}/<"N7,Xpo# >p.NJf pLN^Nup`NVHN$`> g`p.N܄`& af p.NĀ`.}/<"N7,X 9 : >l$p.NH @$HJg )fJ*fS : LN^Nu -fJ*fR of`hNV 9 : >m(JgR : N^Nu.}/<"N7,X 9 :R :"y B q`NVH p.N @$H !fJ*fNJgxpL N^Nu (f@J*f:p.N$p.NX @&H )fJ+g.}/<"N7,X `p.N( @&H g$ =fJ+gR !f +=fJ+g< -fb *tfXJ*fR g:HH"|4~1g&+HHgp`@HHr0.N W~`*S :p.N W~` -fJ*f*HH./<N NdX @ g g )fJ+f.}/<"N7,X*HHL .bF@0; NJ/V66666666666666666666666666666^66x6*p./ N|~XJgp`$p./ N|~XJgp` p./ N|~XJgjp`.@`. /<`.``.`./</ N8P`./<`./<`./<`.N8`~Jfp`rJgp`f g )fJ+fS :Jfp`D./ NX$-Kf p.N @&HJf./.N7,Xg.N .x-@.N .x-@  g g g g g Cg Dg Eg Fg Gg Hg g ffS :Jfp`T./ N N|XJgp`<./ N N|XJfp`$./ N>X`./ NXJnzp`./ NXJmdp` .gRp` .f@p` .n0p` .m p` .lp` .np`p`NVHn/.N X~PJlpN^Nup0. fp`p`NVHn/.N X~PJlpN^NuJop`p`NVHn/.N X~PJlBHn/. N X~PJlB .N^NuNVHn/.N X~PJm.Hn/. N X~PJm0.nf0.nfpN^Nup`NVpH-y -n-np -@9 g .N7Jfp $n g J f B$# * FB *p b @0; NJ  8 D |t  p# .HnNX @-H*g<(j g,f. n/NX$9 g .N7 n-P(j &jJg Jop np./ NX fJg9 fJfp-@$<`pg.N  gNJg-y B-y R|Bxp m A# BHnN MXJfzp-@tp m  `(pgp`p-@tpf nJgpD-@t.t/ NX-@| g .NRx./././N,  # BJxgN.|`~p./9 :/.N 9P @-HgfJg^p./ NX-@. n(g <`p //. n h h/N .N[`.N` f# * `|tNS".g @@fp`p-@Jg B f`$vg.  NYp#   fJ "g.~/9 N7,XA-H.NT p. n/NTX @# A-H.NT p. n/(NTX @# `lփp o4 9 $ g f ./<~` ./<~N7,X9 g .N7.N LN Lp.N LN O`# frgJ fg*Jy Pg 9 f # f F g n.`*g* g$# f " n.N Q n.N Q @@fp./9 fN (`l @g0 9 " ffB`p -@./9 fN '~X&`4p./9 fN '~X&. j/9 fNX @/NXg69 g,. Np ./NdXp ./9 fN\XNAp`  gp./9 NTX @#   Jf:    f.  NZ@p# `B  # # B "N@9 gg2N L`*g$.p/N OvX.p/N OvXg9 g p.N IR @@g  g8p. n/NTX f n.N Q./< N KX gp. n/(NTX.NTrg J f. N Q.NTp p./*NXJg$Jf  fN '.p ./*N`&Jg"p ‘.N9. /.NXp.N8p./*NX-@. /*N`X.N[`. /*NDXp.N8vHnNT X&jJfHnHn/./ N &&j$k-n.N QRy PJfJf gJf.Hn/. / N `6HnNTrX`& p./*NXJf . /*Nx` p./*N`XJf`.N 3 @-HBB -j f y G&9 N @-H`.HnNX @&H&.p f. N-K K./N8XR `Dv R `,./*NX&J lR gp`p# J f,pfp`p(p./*NjXJfp`pgJ oS gp`p# S # *` p./*NXJgJ g . /* `B *`zp./*NnX @-H`HnN QX-@p./*NXHnN QX-@ .. Np ./<jNXp ./.N.Xp ./<pNX .-@ .Ѯp ./.N.Xp ./<vNX .-@ .Ѯp ./.N.`L(jHH"|4~1HHrQ€f./ N7,Xp./9 :/ N 9P @&HJg k.N#b`p.N! @'H k!j k &By PJgt F bg . bN#b .S"n.N Vrl .S"n./< FN XX` .S"n.N @# b# * 9 g 9 *@.N7.N .ȁ B  9 *LN^Nu./*NX$j g. / `JgdJ fZ fp.Nxp.N W~Jg p./< HnNP9 g$p# *9 J oNS g>p`< y A~.N @-Hgj n-HJf./N8X`Lp# S p./.N:X`6&R`^+gA .Ng @(H`I +f./.N gp y !n @# N0p f>Jmp.NxJgF`p'fUf"" J L y 2 PSm y 2 P"hR ` y 2. 2/N RXp fR`+ g  `+ 9 g@ y Sm y "hRp `. p /N RX.N7``9 gH9 g> y Sm y "hRp `. p /N RXNApN` Sn  t`$Sm kRp`.N\$pgJfPJg. jX/NR8XJft `, + f$./ N KXp./p/N XHP` + g`zNVH$.J gHJ lg@J lgB. |/<T/NXPrf( $g./<~N7,XLN^NuB l`NVH$.  lg. N  lg2. |/<T/N WPrg 9 f pLN^Nu | |"| """"2y3  y B9  p9 # p9 # p9 # . /<T/NBPrf `rp./<T/N$Pp09 r# p# lp`@NVH vB $`<./. /.N WP$pg L N^Nu  $fB $R SJfp`NVH$.  lg  lf.N. |/<T/NfPrg 9 f pLN^Nu | |"| """"2y  y0   p9 #   p9 # p9 # . /<T/NPrf `fp09 rr ep`p# p# lp`:NVHtO y Az.N F @$H g".N HS$pl$ o$< LN^NuNVH y $h 9 $( HH&Jo<./ /N Z"P#   lfpo. /<T/N WPL N^NuNVp./< \ y ( HH/N Z"PN^NuNVp .N~NVN^NuNVH y &h# J 2g0(y 2# h# ` , # dJlB d`p# `# d# h# h \NU# #  # y  hBp ./ N W(X @$H f$KJf B9 #`R&y  . AA-H `$pgd  @gpfB9 #HH$f 9 S "BNLN^NuNVH$.p@g  Y |4~0(HHrY€g~p./9 6/< XN 9P @-Hg\.N F @$H gHpP./ HnN NPHnN VX$`A0(HH.Nt SJnpLN^Nup`NVH-y p.N @-HNB @-H n-HB-y  n "nE nr n!n n|  nB nG Bȵbd$n-Jp*-@p-@p$ |3~0(gBp/f JfB Jf>Jgp/f4R.N B @-Hg nA ./.NX @&H Jg |3~0(HHrn€gxSn.NxA-H *g `*.HnNX @&H n. nA /N N|XJgR *gJg(K`.N6 @(XJf. N y Sm( y "hRp `& nJglp-@`. p /N RX./.N8XN` n " ܐ$Ԯ-K` .N VԀJf&n nA("nCe nA &B./9 N XX$n`./NX @$HXJg Jf n "  ./9 NX @$H n"  .N#  .LN^NuSp$c |3~0(HHrn€g |3~0(HHrn€glR`fNVHxdJ g,S  9 "| &1p fv LN^NuN 9 p tmp`pP-@tB $B9 9 f SJg|B $.Hn/9 N XlP$pg`TSA0(HH& 9 R "| #Jf"B p.N>fp./< $N MXJnJ o p.N`&Jfp`p./< $N MX`NVH$. P l 9 R "| #LN^NuNVH$.$y p_f  B y "  mNLN^Nu# `NVH $n&n .A-H KA-HB-n`| nf -@ @gpfNp f" $ Pr$` Snt `^ B@ nf9 g -@ dRHH$f|B .L N^NuNVHA~# A|# A# Ax# $n #  y B.NJl$N./. /.N XlPLN^Nup# lpd./.NۨX. $N M&g.Nמpfp` y A./. N XX9 "HH# X9 "HH# p# t# p.NNp-@B.J gtp.09 H/09 H/NP(P# 09 H hl<09 H# \09 H# `./9 \/9 NNPp.NB N$pg2J.gTB.紹 g" g @gpf2p g,p g&S p 9 pR p" 9 tB2`< ft`* ft` f 9 t9 "HHft(.-DJlxp-@&9 p  "bp@0; NJ#`XL`D:```<< ``jF``pc./ HnN NP9 "HHB29 "HH# p.}9 "HH"n A/N XXp.N HN.N# ppc.Hn/ N NP`# `TN&pf 9  to # t &9 # p `9 "HHTm S2HH$ S"U U"`~N.Nמ`R t&9 tmS t.Np.N ``&9 t` S8S plp\fp`p@ 9 pR p"p`. N V$ й tn # &9 t` Ѓ8S pl-y ` 9 pR p" nRHH&fp.N .N V# t` 9 "HHo 9 "HH(`SS t SJg9 "HHn 9 p.A8//9 N NP 9 p"y B1 9 pA.A8/N XX# ` 9  to # t  9 g 9 o -@p`  -@p.`8# -y `( nR8S t R8gR`&9 p SJg 9 t9 "HHo tm nB`*pfp`p-@t SJg 9 toJtg$28HH$ |4~0(g  8R`N$J28gR tl28HHf`9 "HH& pl28HHgR` 9 "HHo 9 "HH(`^9 f 9 tg 9 t"Rof28HH$ R8 R"R`9 "HH&`&9 t# p` `9 "HH# pp-@Jm9 "HHЄ# p`(&9 p# t# A8./9 N XXB28p.Npf  f . bNN$ g .N`  f B `p# . eN`N۔p`./ NX-@`b./ NX`j D./9 `/9 \NP(P# 09 H# \ dl# d \Nj`3 ^ 3 b p# p.N 9 tR t  9 tB2N۔pfB Nj9 "HHB29 "HHA./ N XXN.Nמ. N V&g `>p`8./9 `/9 \NP(P# 09 H ho Nj`(09 H# \09 H# `./9 \9 "HHA/NNP.N V# t# pp.N`NVH$n`.NHH$fLN^NuNVH $nBv`փ ր r0րp-@N$ |4~0(fJg.N L N^Nu&. lv-B  g g g *g~ .g g _g bgB cg dg fg hg lgr pgX fT$9 p SJg9 "HHn bgp.N 9 p`# p `.p.Np`$9 p SJg, tl$`R2(HH"|4~1HHrY€g` lfL  p& SJo 9 p2HH$ |4~0(g 9 p"R p` ff # p`D cfp`  pgp.N  p`p.N 9 h"9 \R`p.N 9 \`J g . `p.HnNOX @-H 9 t p d# p  9 pA.HnN XX` 9 pR p"HRR t nJfHn 9 pA/N XP`Ft*# p .9 "HH//< t/< p/ N݆JlNj`` 9 9 "HHo|<.9 gHH./9 N6X A".쒈 $p./NX `8NVH$.&. 9  (oLJ g Ѐo` p.NSn`,p .Nx` R"y 1HH.NnJg .NR y A(# LN^NuNVHA# pN./.NۨX9 f.NوrgHnN QX-@B9 ./. /.N XlP&HnN QX-@rlp`p#  n p$Jm f .Nמ fv LN^NuJfx`$S n r08(p fx p g f S"n B1`Lx R"n B1`N y Jg. /9 N XX. N VS# tB pp.N ` 9 \ hf@J to 9 tR"y B1 y 2./9 NYX NI. /<NX @$H./9 \NX @/NX @$H # tp`z pgp# pp.p#/NXp.N p`JNjp# `NVH $.  x&gJo./9 x`dL N^Nu D&J9 #g, 9 x"y 9 "HHЁ‶n` p.N SJf`N "y . I/N X# x`NVH $. 9 p lNjL N^NuJo 9 p"y ES pЂ to 9 t p$ .cg$2(HH&B2(./9 nN XX ( .ygA(./ N XX t`vNV tgJfNfB pB p. 9 tR/NXp.N 2p# pB x# p# |# t y r!A y B y B y B y !| y B y BN^NuNVH$. pf`S tpLN^Nu .ygN&9 pR t y  t .Nnrf./< rN NdX @ fS t(9 p .cf,o(`So S"y 1HH"|3~1fڸo # p` (./< yN NdX @ fR.HH./NX .yf# pp`NVH $. &9 p` y 08HH"|3~1f tnR y 08HH"|3~1g topEg y 08HH"|4~1HHrY€g0 y 08HH"|4~1HHrY€gN tnFR`R y 08HH"|4~1HHrY€f08HH"|3~1f to oS .SJf# pL N^NuR y 08HH"|3~1f tn`NVH $.&9 p SJg` .Wgj y 08HH"|4~1HHrY€gn y 08HH"|4~1HHrY€g tlR`# pL N^NuR y 08HH"|3~1fL tm`BR y 08HH"|4~1HHrY€f08HH"|3~1f tm y 08HH"|3~1g tlR`NVH $.R9 v` Ѐ"ЁЂr0&N$ |4~0(fJnv. 9 N N#  L N^NuNVH$.p# pfN`N&./NXp.N`, fv` fv` fv  gZ gx g gd g g fpӴf Nj`pشfS pNv(p縀glpgdpݸft`$`. 9 p"y  1\fp.p/NX./9 `pӴf&J pfB p.p/NXLN^Nup.p/NnX` 9 p o0S"y 1HH"|3~1gp.p/N0X`(9 ppb.p/NXp.  pR/NX`V 9 p"y  1\fp.p/NX./9 `pӴfp# pp.p$/N`p.NVp.N`F pf:B pӴgN ``pشf 9 p tlpp./NbX 9 t Xl 9 | Xm2 9 t"y  1\gR t I t\p.N0`N&pfz`Xp.p/NXt./N`NVH|$.z|  g g $g ,g| 0g ;gh Bg& Eg0 Fg Tg WgN ^gn bg eg fgN hg lg tg0 wf(9 p./9 NX pf`x`r(9  y 0HHH"|3~1gN tlDR`(9 t`6$9 `$9 tz(9 p. N Nl". 9 N N؀. N No(`(9 p./9 N`(9 p./9 NX 9 pf` 9 j Fg Tg fg tfp;`p,f$,9 tz`,9 tz# jN# (9 p&9  SJg6؅. N Nn y 0HHH f. N No`"p jrTf# ppL|N^Nup`NV. NN^NuNVH $n&y `Jf# L N^NuNVH $.&. ` R"y 1HH.N SJfL N^NuNVH< y (J o< 9 S"| $1pg"p gp g y r!AL` 9 |"ҹ l y rpf 9 Sg, 9 pR"y 1HH@g 9 pR 1fFp.p/NVXp./NXXpf 9 p tlR pp.NHLN^Nu y  p" y  x" y "H.Npf"ѹ p y  pHH$R x` p.N y !B N`~NVH fNjLN^Nu. HnN XX$9 NHn/9 N XP# pHnN VXS# t y !|`NVH 9 p R$o(. y  //9 N NP y B0(LN^NuNVJ9 f0 9 tR"y B1. /9 N XX# p N^NuNVH. /g ?f^p.Np.HH/NnXp.Nxp# p.NB  9 tR"y B1 /fp`p# n pf pLN^NuJ pgHHrrNf"p.N.  y A/N XX Nf 9 nD&`&9 npf 9 \ hm 9 dR# \(9 \.p// y A/NM@ -@0.H# \m y A./9 N XXp`,# \p` NVH pgpB y  "Hfd 9 poV y  (R$ (R&`@ y 08HH( @gpf.p f& Pr$S`LN^Nut& to`R pf8-B ."y m"y "ҹ m y Bp.Nr`RR`.NN y !y x y !y p y  ("y 1HH"H#@ `VNVH$.$y (9 J g*p"y rFg prTf y r;!AprPf$y n * Tb@0; NJUX<L"VJd(Z pgPN&9 tR t 9 t"y B1.p//< t/< p/9 N݆Jg# tNj`$p=f# tR9 p .N`ZS pS t y !|`p.N`J gHH`N$ .NJgN,R9 pLN^NuNj`jN J9 fp# . HnNOX @$Hv p./NXHH&fp`# t pNbp rAftp`N pg 9 pR#  9 xR.NN`#  pN p rIgNR pg 9 pS p# p` t$` J g y $(`N.N$ y !Bpcgpc./N Xrg c fptpx`t$` J g y $(`N.NZ$ y !Bpdf p.N`pd./NXrg 9 p tlR p`Jg pgS pJg s g c gN,pPfR  R fp`p-@ -Jvl` p./NXHH$f$nR` R ftP`N pg # p p`J gHH`N$ Np`tc`~Np./9 NFXJ f 9 pR# `t$` J g y $(`N.N$ y !Bpyf. /9 nN XX`py./N4Xrf~ `tl`Bth`< pg2N 9 p"y 1HH$ |4~0(g  `p` |4~0(g r $p./N\X`Xp.Nh`LNVH$y Zt9 f LN^Nu9 R9 Jf(J Zg J9 Vg. /<bNYXp`p`NVH$n. /<Tp/N WP* gA./<Tp/N WPpLN^NuNVH$n g@J g:A./<Tp/N WPJf . /<Tp/N WPB9 pLN^NuNVH< BJ Zgp.p/N|X. N. N @$H g p* -@$y Z`(R* f. g * gp* -@p ./.NdXt * "y Z) ft+`L< N^Nup* ft-B y Sm y "hR `.  2/N RX y Sm y "hRp `. p /N RXB. gp* ./9 ZNX @&H`&JB. gp ./+N\Xp0+r€gp0+r"| *q`"+ g*|p0+-@`*|4. / NYX.N V-@Jgl y Sm y "hRp(`. p(/N RXp)./.N\X dcp`p& cp`pVЃѮ+ g$. /<>NYX.>N VѮp.p /NX. gp* ./NX @&H`. gp|`p// NP-@. g2 g. /<*` * "f. /<&NYX fV* g* `0* g(.NJg. N @&H g p+ -@$L gb`NVH$n$. `p* f J LN^Nu$R f`NVH$n$.J 2g . /. *Ђ/NL nSm n"hRp` .N\$HHg pL N^NuRJfp`NVH $y Zt` &R.N#b$K fB ZB RB V` | ^B0(SlL N^NuNVH.N& @$H g.* p* LN^Nup`NVH$y Z(y 2Jg` *g * Ff&J$R f$y  g# `$p&.N! @$H f./<}N7,XR VR R g $&k `$ ZN@ # Z%n| %y F g ,S.NL`p%@Bj  Rm p./NNX J LN^Nu`NVH$.f LN^Nu$y Z` *g$R f J`NVH<$.Bp-@ʴgRJgNJ g.N @$H  f gB ` .Nz @$HJ g g:* f0p* -@J f9 g g.N$N` J g`9 .N @$Hf9 g ../ N.X gfS V "f B "B g 9 f6.N @-Hg(Jgf9 g.N| n$(`bp(9 gf .*Jgpf. /<NYX(pgjp gbf 9 fp ./NX @/NX.  "| /1NYX.g. /<NYX y Sm y "hRp `. p /N RXfJg @` -@`Jf&  l# *# * Lfp/N OvX  f 9 g9 HnN ZX&pf $fN<`  $f9 gt`zNVH np( $$y Z`p* f * f&J$R f g+  K LN^Nu$y Z`2(Rp* g&J` S R f# Z`&$ # $L f np( .N`NVH $n Zf# ZL N^Nu&y Z g Sf&`&S`NVH tv`R | ^ 0(g | ^E(R`Rփpf  L N^NuNVH$.S j,DD& 爔p( | ^"F08LN^Nu`NVH(n$JfH . f: . g p=./, N NdX @&H gBp ( LN^Nu.N F @$H gP.N V$ R.N! @&H./ N XX.N DJf . g 9@`9n`9n( g./ N 4X.N#b`pNV-y  9 R r o.}/.NX# p.N-@# S N^NuNVH B`*(T fp`p./ /.N 9P @$Hp-@&L g g J LN^NuNVR9 . /.NXB9 N^NuNVH<$n &ntIJ9 f+g./+ N7,X+g./ NX @(H+g(T+g+g (L<N^Nu g .N .x` p # p-@Jkf7y +g. T hN`Jfp.N! @( T Jg 0f`prf"p=./+ N NdX @-H.g GBp g. g*`R  g  g+g+g `R 0g @f Jg.N#b+g*T`< g..N V$0+Ho `0+HR.N! @*H`( g+g ./ N 8`+g ./ N 8X+g+gp0`./ N X`+gp .0+H// N AP`V+gL.N VE0+KBd0 `NVH $n Rr2$ n hr2(.N ?HX @&H-J J.N @$HHH$B nA.N .x&  lJl./.N7,X` 6 n(fNJf .N#b`x.N F @$H g, n. N0 @-H"n ./.N 42X'np0+c./ N >HX @&H n!K n n h"0 n L N^NuNVH $nt` R`p]fSJoRHH&gp[f` J L N^NuNVH< n -P(n`4,f&$l &nJfJg =f gB+l`. g*L(l fJf L<N^Nu.N @(H)n n L`NVH.N V.N! @$H g$A%H ./N XXBBBBj J LN^NuNVH$. S .N! @$H 5@B`S CBJf J LN^NuNVH$n -n nRHH$g$HH& Jg *g ?g [g \fHH&g`PB.p-@B !fp-@HH&g(p]f*Jm$.HHg./.NPXLN^Nup`p-fHJmB ]g<HH&Jg .氂noR.` .氂lnR.`xp\fHH&Jg gR.`g-C`LJgrp`nR *gJg^p`ZR *gJgJ(HH&p?g p[gp`p$p\f *HH&JgJgf./.NVXJg p`p`-n nRHH(`NVH. N(Jfp` nr2(.N$  m./. NX @/N7,X$n&J goh SP.N! @$H5nv` CBRm gFv` C(q C#Rp0+c.N#b` . r2*c5n4 J LN^NuNVH .r& o <L N^Nu `NVHv`փ o ЀS(JjDD`gZ . -@vl$`: "nE. /2N N|XJn -r %$蔄JlR`LN^NuNVH $n&n . N G$0+HSĀ C%q C#L N^NuNVH  n$E f*g$Rg gJg.`&R g.N#b.N#bL N^NuNVH$n `./.NHX$R fLN^NuNV# # . /.NXp# # N^NuNVH 9 @&t` "HC$q` -@J g 9 f `zJfr*gT&j gVp0-@p-@6 .r2+b>6 .CJg. nNp0-@R`pfJg. nN$j f`R n 0(HmN@dN Z4Nu0<*N@dN Z4 o BNuNV# N^NuNV.ANm 9 N N09# rN^NuNVH$n* HH$Jg* g .N#b* %n fz pl> "|  q%HA&H* HH"| #%jBLN^Nu "| rA%HA(H* HH"| #`* HH"| A"jC .N W~Jg `NVp.N LN^Nu0<'N@Nu0<N@Nu0<N@dN Z4BNu o HBNu o /fpL.Nu0<%N@dN Z4BNuNVH<zJlDD&".l&DD` NVH<z .lDD&". lDD( lB@H@40H@0H@`* l$//N YPlS JlDL new-line space tab A blank is a tab or a space. An identifier is a sequence of letters, digits, or underscores starting with a letter or underscore. Identifiers are used as names for aliases, functions, and named parameters. A word is a sequence of characters separated by one or more non-quoted metacharacters. Commands. A simple-command is a sequence of blank separated words which may be preceded by a parameter assignment list. (See Environment below). The first word specifies the name of the command to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command. The command name is passed as argument 0 (see exec(2)). The value of a simple-command is its exit status if it terminates normally, or (octal) 200+status if it terminates abnormally (see signal(2) for a list of status values). A pipeline is a sequence of one or more commands separated by |. The standard output of each command but the last is connected by a pipe(2) to the standard input of the next command. Each command is run as a separate process; the shell waits for the last command to terminate. The exit status of a pipeline is the exit status of the last command. A list is a sequence of one or more pipelines separated by ;, &, &&, or ||, and optionally terminated by ;, &, or |&. Of these five symbols, ;, &, and |& have equal precedence, Page 1 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) which is lower than that of && and ||. The symbols && and || also have equal precedence. A semicolon (;) causes sequential execution of the preceding pipeline; an ampersand (&) causes asynchronous execution of the preceding pipeline (i.e., the shell does not wait for that pipeline to finish). The symbol |& causes asynchronous execution of the preceding command or pipeline with a two-way pipe established to the parent shell. The standard input and output of the spawned command can be written to and read from by the parent Shell using the -p option of the special commands read and print described later. Only one such command can be active at any given time. The symbol && (||) causes the list following it to be executed only if the preceding pipeline returns a zero (non-zero) value. An arbitrary number of new-lines may appear in a list, instead of semicolons, to delimit commands. A command is either a simple-command or one of the following. Unless otherwise stated, the value returned by a command is that of the last simple-command executed in the command. for identifier [ in word ... ] do list done Each time a for command is executed, identifier is set to the next word taken from the in word list. If in word ... is omitted, then the for command executes the do list once for each positional parameter that is set (see Parameter Substitution below). Execution ends when there are no more words in the list. select identifier [ in word ... ] do list done A select command prints on standard error (file descriptor 2), the set of words, each preceded by a number. If in word ... is omitted, then the positional parameters are used instead (see Parameter Substitution below). The PS3 prompt is printed and a line is read from the standard input. If this line consists of the number of one of the listed words, then the value of the parameter identifier is set to the word corresponding to this number. If this line is empty the selection list is printed again. Otherwise the value of the parameter identifier is set to null. The contents of the line read from standard input is saved in the parameter REPLY. The list is executed for each selection until a break or end-of-file is encountered. case word in [ pattern [ | pattern ] ... ) list ;; ] ... esac A case command executes the list associated with the first pattern that matches word. The form of the patterns is the same as that used for file-name generation (see File Name Generation below). Page 2 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) if list then list [ elif list then list ] ... [ else list ] fi The list following if is executed and, if it returns a zero exit status, the list following the first then is executed. Otherwise, the list following elif is executed and, if its value is zero, the list following the next then is executed. Failing that, the else list is executed. If no else list or then list is executed, then the if command returns a zero exit status. while list do list done until list do list done A while command repeatedly executes the while list and, if the exit status of the last command in the list is zero, executes the do list; otherwise the loop terminates. If no commands in the do list are executed, then the while command returns a zero exit status; until may be used in place of while to negate the loop termination test. (list) Execute list in a separate environment. Note, that if two adjacent open parentheses are needed for nesting, a space must be inserted to avoid arithmetic evaluation as described below. A parenthesized list used as a command argument denotes process substitution as described below. { list;} list is simply executed. Note that { is a keyword and requires a blank in order to be recognized. function identifier { list ;} identifier () { list ;} Define a function which is referenced by identifier. The body of the function is the list of commands between { and }. (See Functions below). time pipeline The pipeline is executed and the elapsed time as well as the user and system time are printed on standard error. The following keywords are only recognized as the first word of a command and when not quoted: if then else elif fi case esac for while until do done { } function select time Comments. A word beginning with # causes that word and all the following characters up to a new-line to be ignored. Page 3 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) Aliasing. The first word of each command is replaced by the text of an alias if an alias for this word has been defined. The first character of an alias name can be any non-special printable character, but the rest of the characters must be the same as for a valid identifier. The replacement string can contain any valid Shell script including the metacharacters listed above. The first word of each command of the replaced text will not be tested for additional aliases. If the last character of the alias value is a blank then the word following the alias will also be checked for alias substitution. Aliases can be used to redefine special builtin commands but cannot be used to redefine the keywords listed above. Aliases can be created, listed, and exported with the alias command and can be removed with the unalias command. Exported aliases remain in effect for sub-shells but must be reinitialized for separate invocations of the Shell (See Invocation below). Aliasing is performed when scripts are read, not while they are executed. Therefore, for an alias to take effect the alias command has to be executed before the command which references the alias is read. Aliases are frequently used as a short hand for full path names. An option to the aliasing facility allows the value of the alias to be automatically set to the full pathname of the corresponding command. These aliases are called tracked aliases. The value of a tracked alias is defined the first time the corresponding command is looked up and becomes undefined each time the PATH variable is reset. These aliases remain tracked so that the next subsequent reference will redefine the value. Several tracked aliases are compiled into the shell. The -h option of the set command makes each command name which is a valid alias name into a tracked alias. The following exported aliases are compiled into the shell but can be unset or redefined: false='let 0' functions='typeset -f' history='fc -l' integer='typeset -i' nohup='nohup ' r='fc -e -' true=':' type='whence -v' hash='alias -t' Tilde Substitution. After alias substitution is performed, each word is checked to see if it begins with an unquoted 8. If it does, then 9~ Page 4 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) the word up to a / is checked to see if it matches a user name in the /etc/passwd file. If a match is found, the 8 and the matched login name is replaced by the login 9~ directory of the matched user. This is called a tilde substitution. If no match is found, the original text is left unchanged. A 8 by itself, or in front of a /, is replaced by the value of the HOME parameter. A 8 followed by a + or - is replaced by the value of the parameter PWD and OLDPWD respectively. In addition, the value of each keyword parameter is checked to see if it begins with a 8 or if a 8 appears after a :. In either of these cases a9tilde substitution is attempted. Command Substitution. The standard output from a command enclosed in parenthesis preceded by a dollar sign ( $() ) or a pair of grave accents (``) may be used as part or all of a word; trailing new- lines are removed. In the second (archaic) form, the string between the quotes is processed for special quoting characters before the command is executed. (See Quoting below). The command substitution $(cat file) can be replaced by the equivalent but faster $((list) will run process list asynchronously connected to some file in /dev/fd. The name of this file will become the argument to the command. If the form with > is selected then writing on this file will provide input for list. If < is used or omitted, then the file passed as an argument will contain the output of the list process. For example, paste (cut -f1 file1) (cut -f3 file2) | tee >(process1) >(process2) cuts fields 1 and 3 from the files file1 and file2 respectively, pastes the results together, and sends it to the processes process1 and process2, as well as putting it onto the standard output. Note that the file, which is passed as an argument to the command, is a UNIX pipe(2) so programs that expect to lseek(2) on the file will not work. Parameter Substitution. A parameter is an identifier, one or more digits, or any of the characters *, @, #, ?, -, $, and !. A named parameter Page 5 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) (a parameter denoted by an identifier) has a value and zero or more attributes. Named parameters can be assigned values and attributes by using the typeset special command. The attributes supported by the Shell are described later with the typeset special command. Exported parameters pass values and attributes to sub-shells but only values to the environment. The shell supports a limited one-dimensional array facility. An element of an array parameter is referenced by a subscript. A subscript is denoted by a [, followed by an arithmetic expression (see Arithmetic evaluation below) followed by a ]. The value of all subscripts must be in the range of 0 through 511. Arrays need not be declared. Any reference to a named parameter with a valid subscript is legal and an array will be created if necessary. Referencing an array without a subscript is equivalent to referencing the first element. The value of a named parameter may also be assigned by writing: name=value [ name=value ] ... If the integer attribute, -i, is set for name the value is subject to arithmetic evaluation as described below. Positional parameters, parameters denoted by a number, may be assigned values with the set special command. Parameter $0 is set from argument zero when the shell is invoked. The character $ is used to introduce substitutable parameters. ${parameter} The value, if any, of the parameter is substituted. The braces are required when parameter is followed by a letter, digit, or underscore that is not to be interpreted as part of its name or when a named parameter is subscripted. If parameter is one or more digits then it is a positional parameter. A positional parameter of more than one digit must be enclosed in braces. If parameter is * or @, then all the positional parameters, starting with $1, are substituted (separated by a field separator character). If an array identifier with subscript * or @ is used, then the value for each of the elements is substituted (separated by a field separator character). ${#parameter} If parameter is * or @, the number of positional parameters is substituted. Otherwise, the length of the value of the parameter is substituted. ${#identifier[*]} The number of elements in the array identifier is substituted. Page 6 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) ${parameter:-word} If parameter is set and is non-null then substitute its value; otherwise substitute word. ${parameter:=word} If parameter is not set or is null then set it to word; the value of the parameter is then substituted. Positional parameters may not be assigned to in this way. ${parameter:?word} If parameter is set and is non-null then substitute its value; otherwise, print word and exit from the shell. If word is omitted then a standard message is printed. ${parameter:+word} If parameter is set and is non-null then substitute word; otherwise substitute nothing. ${parameter#pattern} ${parameter##pattern} If the Shell pattern matches the beginning of the value of parameter, then the value of this substitution is the value of the parameter with the matched portion deleted; otherwise the value of this parameter is substituted. In the first form the smallest matching pattern is deleted and in the latter form the largest matching pattern is deleted. ${parameter%pattern} ${parameter%%pattern} If the Shell pattern matches the end of the value of parameter, then the value of parameter with the matched part deleted; otherwise substitute the value of parameter. In the first form the smallest matching pattern is deleted and in the latter form the largest matching pattern is deleted. In the above, word is not evaluated unless it is to be used as the substituted string, so that, in the following example, pwd is executed only if d is not set or is null: echo ${d:-$(pwd)} If the colon ( : ) is omitted from the above expressions, then the shell only checks whether parameter is set or not. The following parameters are automatically set by the shell: # The number of positional parameters in decimal. - Flags supplied to the shell on invocation or by the set command. ? The decimal value returned by the last executed command. $ The process number of this shell. _ The last argument of the previous command. This parameter is not set for commands which are Page 7 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) asynchronous. This parameter is also used to hold the name of the matching MAIL file when checking for mail. Finally, the value of this parameter is set to the full path name of each program the shell invokes and is passed in the environment. ! The process number of the last background command invoked. PPID The process number of the parent of the shell. PWD The present working directory set by the cd command. OLDPWD The previous working directory set by the cd command. RANDOM Each time this parameter is referenced, a random integer is generated. The sequence of random numbers can be initialized by assigning a numeric value to RANDOM. REPLY This parameter is set by the select statement and by the read special command when no arguments are supplied. SECONDS Each time this parameter is referenced, the number of seconds since shell invocation is returned. If this parameter is assigned a value, then the value returned upon reference will be the value that was assigned plus the number of seconds since the assignment. The following parameters are used by the shell: CDPATH The search path for the cd command. COLUMNS If this variable is set, the value is used to define the width of the edit window for the shell edit modes and for printing select lists. EDITOR If the value of this variable ends in emacs, gmacs, or vi and the VISUAL variable is not set, then the corresponding option (see Special Command set below) will be turned on. ENV If this parameter is set, then parameter substitution is performed on the value to generate the pathname of the script that will be executed when the shell is invoked. (See Invocation below.) This file is typically used for alias and function definitions. FCEDIT The default editor name for the fc command. IFS Internal field separators, normally space, tab, and new-line that is used to separate command Page 8 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) words which result from command or parameter substitution and for separating words with the special command read. The first character of the IFS parameter is used to separate arguments for the "$*" substitution (See Quoting below). HISTFILE If this parameter is set when the shell is invoked, then the value is the pathname of the file that will be used to store the command history. (See Command re-entry below.) HISTSIZE If this parameter is set when the shell is invoked, then the number of previously entered commands that are accessible by this shell will be greater than or equal to this number. The default is 128. HOME The default argument (home directory) for the cd command. LINES If this variable is set, the value is used to determine the column length for printing select lists. Select lists will print vertically until about two-thirds of LINES lines are filled. MAIL If this parameter is set to the name of a mail file and the MAILPATH parameter is not set, then the shell informs the user of arrival of mail in the specified file. MAILCHECK This variable specifies how often (in seconds) the shell will check for changes in the modification time of any of the files specified by the MAILPATH or MAIL parameters. The default value is 600 seconds. When the time has elapsed the shell will check before issuing the next prompt. MAILPATH A colon ( : ) separated list of file names. If this parameter is set then the shell informs the user of any modifications to the specified files that have occurred within the last MAILCHECK seconds. Each file name can be followed by a ? and a message that will be printed. The message will undergo parameter and command substitution with the parameter, $_ defined as the name of the file that has changed. The default message is you have mail in $_. PATH The search path for commands (see Execution below). The user may not change PATH if executing under rsh (except in .profile ). PS1 The value of this parameter is expanded for parameter substitution to define the primary prompt string which by default is ``$ ''. The character ! in the primary prompt string is Page 9 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) replaced by the command number (see Command Re- entry below). PS2 Secondary prompt string, by default ``> ''. PS3 Selection prompt string used within a select loop, by default ``#? ''. SHELL The pathname of the shell is kept in the environment. At invocation, if the value of this variable contains an r in the basename, then the shell becomes restricted. TMOUT If set to a value greater than zero, the shell will terminate if a command is not entered within the prescribed number of seconds after issuing the PS1 prompt. (Note that the shell can be compiled with a maximum bound for this value which cannot be exceeded.) VISUAL If the value of this variable ends in emacs, gmacs, or vi then the corresponding option (see Special Command set below) will be turned on. The shell gives default values to PATH, PS1, PS2, MAILCHECK, TMOUT and IFS, while HOME, SHELL ENV and MAIL are not set at all by the shell (although HOME is set by login(1)). On some systems MAIL and SHELL are also set by login(1)). Blank Interpretation. After parameter and command substitution, the results of substitutions are scanned for the field separator characters ( those found in IFS ) and split into distinct arguments where such characters are found. Explicit null arguments ("" or '') are retained. Implicit null arguments (those resulting from parameters that have no values) are removed. File Name Generation. Following substitution, each command word is scanned for the characters *, ?, and [ unless the -f option has been set. If one of these characters appears then the word is regarded as a pattern. The word is replaced with alphabetically sorted file names that match the pattern. If no file name is found that matches the pattern, then the word is left unchanged. When a pattern is used for file name generation, the character . at the start of a file name or immediately following a /, as well as the character / itself, must be matched explicitly. In other instances of pattern matching the / and . are not treated specially. * Matches any string, including the null string. ? Matches any single character. [...] Matches any one of the enclosed characters. A Page 10 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) pair of characters separated by - matches any character lexically between the pair, inclusive. If the first character following the opening "[ " is a "! " then any character not enclosed is matched. A - can be included in the character set by putting it as the first or last character. Quoting. Each of the metacharacters listed above (See Definitions above) has a special meaning to the shell and causes termination of a word unless quoted. A character may be quoted (i.e., made to stand for itself) by preceding it with a \. The pair \new-line is ignored. All characters enclosed between a pair of single quote marks (''), are quoted. A single quote cannot appear within single quotes. Inside double quote marks (""), parameter and command substitution occurs and \ quotes the characters \, `, ", and $. The meaning of $* and $@ is identical when not quoted or when used as a parameter assignment value or as a file name. However, when used as a command argument, "$*" is equivalent to "$1d$2d...", where d is the first character of the IFS parameter, whereas "$@" is equivalent to "$1" "$2" .... Inside grave quote marks (``) \ quotes the characters \, `, and $. If the grave quotes occur within double quotes then \ also quotes the character ". The special meaning of keywords or aliases can be removed by quoting any character of the keyword. The recognition of function names or special command names listed below cannot be altered by quoting them. Arithmetic Evaluation. An ability to perform integer arithmetic is provided with the special command let. Evaluations are performed using long arithmetic. Constants are of the form [base#]n where base is a decimal number between two and thirty-six representing the arithmetic base and n is a number in that base. If base is omitted then base 10 is used. An internal integer representation of a named parameter can be specified with the -i option of the typeset special command. When this attribute is selected the first assignment to the parameter determines the arithmetic base to be used when parameter substitution occurs. Since many of the arithmetic operators require quoting, an alternative form of the let command is provided. For any command which begins with a ((, all the characters until a matching )) are treated as a quoted expression. More precisely, ((...)) is equivalent to let "...". Prompting. Page 11 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) When used interactively, the shell prompts with the value of PS1 before reading a command. If at any time a new-line is typed and further input is needed to complete a command, then the secondary prompt (i.e., the value of PS2) is issued. Input/Output. Before a command is executed, its input and output may be redirected using a special notation interpreted by the shell. The following may appear anywhere in a simple- command or may precede or follow a command and are not passed on to the invoked command. Command and parameter substitution occurs before word or digit is used except as noted below. File name generation occurs only if the pattern matches a single file and blank interpretation is not performed. word Use file word as standard output (file descriptor 1). If the file does not exist then it is created; otherwise, it is truncated to zero length. >>word Use file word as standard output. If the file exists then output is appended to it (by first seeking to the end-of-file); otherwise, the file is created. <<[-]word The shell input is read up to a line that is the same as word, or to an end-of-file. No parameter substitution, command substitution or file name generation is performed on word. The resulting document, called a here- document, becomes the standard input. If any character of word is quoted, then no interpretation is placed upon the characters of the document; otherwise, parameter and command substitution occurs, \new-line is ignored, and \ must be used to quote the characters \, $, `, and the first character of word. If - is appended to <<, then all leading tabs are stripped from word and from the document. <&digit The standard input is duplicated from file descriptor digit (see dup(2)). Similarly for the standard output using >& digit. <&- The standard input is closed. Similarly for the standard output using >&-. Page 12 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) If one of the above is preceded by a digit, then the file descriptor number referred to is that specified by the digit (instead of the default 0 or 1). For example: ... 2>&1 means file descriptor 2 is to be opened for writing as a duplicate of file descriptor 1. The order in which redirections are specified is significant. The shell evaluates each redirection in terms of the (file descriptor, file) association at the time of evaluation. For example: ... 1>fname 2>&1 first associates file descriptor 1 with file fname. It then associates file descriptor 2 with the file associated with file descriptor 1 (i.e. fname). If the order of redirections were reversed, file descriptor 2 would be associated with the terminal (assuming file descriptor 1 had been) and then file descriptor 1 would be associated with file fname. If a command is followed by & and job control is not active, then the default standard input for the command is the empty file /dev/null. Otherwise, the environment for the execution of a command contains the file descriptors of the invoking shell as modified by input/output specifications. Environment. The environment (see environ(7)) is a list of name-value pairs that is passed to an executed program in the same way as a normal argument list. The names must be identifiers and the values are character strings. The shell interacts with the environment in several ways. On invocation, the shell scans the environment and creates a parameter for each name found, giving it the corresponding value and marking it export . Executed commands inherit the environment. If the user modifies the values of these parameters or creates new ones, using the export or typeset -x commands they become part of the environment. The environment seen by any executed command is thus composed of any name-value pairs originally inherited by the shell, whose values may be modified by the current shell, plus any additions which must be noted in export or typeset -x commands. The environment for any simple-command or function may be augmented by prefixing it with one or more parameter assignments. A parameter assignment argument is a word of the form identifier=value. Thus: Page 13 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) TERM=450 cmd args and (export TERM; TERM=450; cmd args) are equivalent (as far as the above execution of cmd is concerned). If the -k flag is set, all parameter assignment arguments are placed in the environment, even if they occur after the command name. The following first prints a=b c and then c: echo a=b c set -k echo a=b c Functions. The function keyword, described in the Commands section above, is used to define shell functions. Shell functions are read in and stored internally. Alias names are resolved when the function is read. Functions are executed like commands with the arguments passed as positional parameters. (See Execution below). Functions execute in the same process as the caller and share all files, traps ( other than EXIT and ERR) and present working directory with the caller. A trap set on EXIT inside a function is executed after the function completes. Ordinarily, variables are shared between the calling program and the function. However, the typeset special command used within a function defines local variables whose scope includes the current function and all functions it calls. The special command return is used to return from function calls. Errors within functions return control to the caller. Function identifiers can be listed with the -f option of the typeset special command. The text of functions will also be listed. Function can be undefined with the -f option of the unset special command. Ordinarily, functions are unset when the shell executes a shell script. The -xf option of the typeset command allows a function to be exported to scripts that are executed without a separate invocation of the shell. Functions that need to be defined across separate invocations of the shell should be placed in the ENV file. Jobs. If the monitor option of the set command is turned on, an interactive shell associates a job with each pipeline. It keeps a table of current jobs, printed by the jobs command, Page 14 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) and assigns them small integer numbers. When a job is started asynchronously with &, the shell prints a line which looks like: [1] 1234 indicating that the job which was started asynchronously was job number 1 and had one (top-level) process, whose process id was 1234. This paragraph and the next require features that are not in all versions of UNIX and may not apply. If you are running a job and wish to do something else you may hit the key ^Z (control-Z) which sends a STOP signal to the current job. The shell will then normally indicate that the job has been `Stopped', and print another prompt. You can then manipulate the state of this job, putting it in the background with the bg command, or run some other commands and then eventually bring the job back into the foreground with the foreground command fg. A ^Z takes effect immediately and is like an interrupt in that pending output and unread input are discarded when it is typed. A job being run in the background will stop if it tries to read from the terminal. Background jobs are normally allowed to produce output, but this can be disabled by giving the command ``stty tostop''. If you set this tty option, then background jobs will stop when they try to produce output like they do when they try to read input. There are several ways to refer to jobs in the shell. The character % introduces a job name. If you wish to refer to job number 1, you can name it as %1 . Jobs can also be named by prefixes of the string typed in to kill or restart them. Thus, on systems that support job control, `fg %ed' would normally restart a suspended ed(1) job, if there were a suspended job whose name began with the string `ed'. The shell maintains a notion of the current and previous jobs. In output pertaining to jobs, the current job is marked with a + and the previous job with a -. The abbreviation %+ refers to the current job and %- refers to the previous job. %% is also a synonym for the current job. This shell learns immediately whenever a process changes state. It normally informs you whenever a job becomes blocked so that no further progress is possible, but only just before it prints a prompt. This is done so that it does not otherwise disturb your work. When you try to leave the shell while jobs are running or stopped, you will be warned that `You have stopped(running) Page 15 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) jobs.' You may use the jobs command to see what they are. If you do this or immediately try to exit again, the shell will not warn you a second time, and the stopped jobs will be terminated. Signals. The INT and QUIT signals for an invoked command are ignored if the command is followed by & and job monitor option is not active. Otherwise, signals have the values inherited by the shell from its parent (but see also the trap command below). Execution. Each time a command is executed, the above substitutions are carried out. If the command name matches one of the Special Commands listed below, it is executed within the current shell process. Next, the command name is checked to see if it matches one of the user defined functions. If it does, the positional parameters are saved and then reset to the arguments of the function call. When the function completes or issues a return, the positional parameter list is restored and any trap set on EXIT within the function is executed. The value of a function is the value of the last command executed. A function is also executed in the current shell process. If a command name is not a special command or a user defined function, a process is created and an attempt is made to execute the command via exec(2). The shell parameter PATH defines the search path for the directory containing the command. Alternative directory names are separated by a colon (:). The default path is /bin:/usr/bin: (specifying /bin, /usr/bin, and the current directory in that order). The current directory can be specified by two or more adjacent colons, or by a colon at the beginning or end of the path list. If the command name contains a / then the search path is not used. Otherwise, each directory in the path is searched for an executable file. If the file has execute permission but is not a directory or an a.out file, it is assumed to be a file containing shell commands. A sub-shell is spawned to read it. All non-exported aliases, functions, and named parameters are removed in this case. If the shell command file doesn't have read permission, or if the setuid and/or setgid bits are set on the file, then the shell executes an agent whose job it is to set up the permissions and execute the shell with the shell command file passed down as an open file. A parenthesized command is also executed in a sub- shell without removing non-exported quantities. Command Re-entry. The text of the last HISTSIZE (default 128) commands entered from a terminal device is saved in a history file. The file Page 16 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) $HOME/.sh_history is used if the HISTFILE variable is not set or is not writable. A shell can access the commands of all interactive shells which use the same named HISTFILE. The special command fc is used to list or edit a portion of this file. The portion of the file to be edited or listed can be selected by number or by giving the first character or characters of the command. A single command or range of commands can be specified. If you do not specify an editor program as an argument to fc then the value of the parameter FCEDIT is used. If FCEDIT is not defined then /bin/ed is used. The edited command(s) is printed and re-executed upon leaving the editor. The editor name - is used to skip the editing phase and to re-execute the command. In this case a substitution parameter of the form old=new can be used to modify the command before execution. For example, if r is aliased to 'fc -e -' then typing `r bad=good c' will re- execute the most recent command which starts with the letter c, replacing the first occurrence of the string bad with the string good. In-line Editing Options Normally, each command line entered from a terminal device is simply typed followed by a new-line (`RETURN' or `LINE FEED'). If either the emacs, gmacs, or vi option is active, the user can edit the command line. To be in either of these edit modes set the corresponding option. An editing option is automatically selected each time the VISUAL or EDITOR variable is assigned a value ending in either of these option names. The editing features require that the user's terminal accept `RETURN' as carriage return without line feed and that a space (` ') must overwrite the current character on the screen. ADM terminal users should set the "space - advance" switch to `space'. Hewlett-Packard series 2621 terminal users should set the straps to `bcGHxZ etX'. The editing modes implement a concept where the user is looking through a window at the current line. The window width is the value of COLUMNS if it is defined, otherwise 80. If the line is longer than the window width minus two, a mark is displayed at the end of the window to notify the user. As the cursor moves and reaches the window boundaries the window will be centered about the cursor. The mark is a > (<, *) if the line extends on the right (left, both) side(s) of the window. Emacs Editing Mode This mode is entered by enabling either the emacs or gmacs option. The only difference between these two modes is the way they handle ^T. To edit, the user moves the cursor to the point needing correction and then inserts or deletes Page 17 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) characters or words as needed. All the editing commands are control characters or escape sequences. The notation for control characters is caret ( ^ ) followed by the character. For example, ^F is the notation for control F. This is entered by depressing `f' while holding down the `CTRL' (control) key. The `SHIFT' key is not depressed. (The notation ^? indicates the DEL (delete) key.) The notation for escape sequences is M- followed by a character. For example, M-f (pronounced Meta f) is entered by depressing ESC (ascii 033) followed by `f'. (M-F would be the notation for ESC followed by `SHIFT' (capital) `F'.) All edit commands operate from any place on the line (not just at the beginning). Neither the "RETURN" nor the "LINE FEED" key is entered after edit commands except when noted. ^F Move cursor forward (right) one character. M-f Move cursor forward one word. (The editor's idea of a word is a string of characters consisting of only letters, digits and underscores.) ^B Move cursor backward (left) one character. M-b Move cursor backward one word. ^A Move cursor to start of line. ^E Move cursor to end of line. ^]char Move cursor to character char on current line. ^X^X Interchange the cursor and mark. erase (User defined erase character as defined by the stty command, usually ^H or #.) Delete previous character. ^D Delete current character. M-d Delete current word. M-^H (Meta-backspace) Delete previous word. M-h Delete previous word. M-^? (Meta-DEL) Delete previous word (if your interrupt character is ^? (DEL, the default) then this command will not work). ^T Transpose current character with next character in emacs mode. Transpose two previous characters in gmacs mode. ^C Capitalize current character. M-c Capitalize current word. M-l Change the current word to lower case. ^K Kill from the cursor to the end of the line. If given a parameter of zero then kill from the start of line to the cursor. ^W Kill from the cursor to the mark. M-p Push the region from the cursor to the mark on the stack. kill (User defined kill character as defined by the stty command, usually ^G or @.) Kill the entire current line. If two kill characters are entered Page 18 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) in succession, all kill characters from then on cause a line feed (useful when using paper terminals). ^Y Restore last item removed from line. (Yank item back to the line.) ^L Line feed and print current line. ^@ (Null character) Set mark. M- (Meta space) Set mark. ^J (New line) Execute the current line. ^M (Return) Execute the current line. eof End-of-file character, normally ^D, will terminate the shell if the current line is null. ^P Fetch previous command. Each time ^P is entered the previous command back in time is accessed. M-< Fetch the least recent (oldest) history line. M-> Fetch the most recent (youngest) history line. ^N Fetch next command. Each time ^N is entered the next command forward in time is accessed. ^Rstring Reverse search history for a previous command line containing string. If a parameter of zero is given, the search is forward. String is terminated by a "RETURN" or "NEW LINE". If string is omitted, then the next command line containing the most recent string is accessed. In this case a parameter of zero reverses the direction of the search. ^O Operate - Execute the current line and fetch the next line relative to current line from the history file. M-digits (Escape) Define numeric parameter, the digits are taken as a parameter to the next command. The commands that accept a parameter are ., ^F, ^B, erase, ^D, ^K, ^R, ^P, ^N, M-., M-_, M-b, M-c, M- d, M-f, M-h and M-^H. M-letter Soft-key - Your alias list is searched for an alias by the name _letter and if an alias of this name is defined, its value will be inserted on the input queue. The letter must not be one of the above meta-functions. M-. The last word of the previous command is inserted on the line. If preceded by a numeric parameter, the value of this parameter determines which word to insert rather than the last word. M-_ Same as M-.. M-* Attempt file name generation on the current word. An asterisk is appended if the word doesn't contain any special pattern characters. M-ESC Same as M-*. M-= List files matching current word pattern if an asterisk were appended. ^U Multiply parameter of next command by 4. \ Escape next character. Editing characters, the Page 19 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) user's erase, kill and interrupt (normally ^?) characters may be entered in a command line or in a search string if preceded by a \. The \ removes the next character's editing features (if any). ^V Display version of the shell. Vi Editing Mode There are two typing modes. Initially, when you enter a command you are in the input mode. To edit, the user enters control mode by typing ESC ( 033 ) and moves the cursor to the point needing correction and then inserts or deletes characters or words as needed. Most control commands accept an optional repeat count prior to the command. When in vi mode on most systems, canonical processing is initially enabled and the command will be echoed again if the speed is 1200 baud or greater and it contains any control characters or less than one second has elapsed since the prompt was printed. The ESC character terminates canonical processing for the remainder of the command and the user can than modify the command line. This scheme has the advantages of canonical processing with the type-ahead echoing of raw mode. If the option viraw is also set, the terminal will always have canonical processing disabled. This mode is implicit for systems that do not support two alternate end of line delimiters, and may be helpful for certain terminals. Input Edit Commands By default the editor is in input mode. erase (User defined erase character as defined by the stty command, usually ^H or #.) Delete previous character. ^W Delete the previous blank separated word. ^D Terminate the shell. ^V Escape next character. Editing characters, the user's erase or kill characters may be entered in a command line or in a search string if preceded by a ^V. The ^V removes the next character's editing features (if any). \ Escape the next erase or kill character. Motion Edit Commands These commands will move the cursor. [count]l Cursor forward (right) one character. [count]w Cursor forward one alpha-numeric word. [count]W Cursor to the beginning of the next word that follows a blank. [count]e Cursor to end of word. [count]E Cursor to end of the current blank delimited word. [count]h Cursor backward (left) one character. [count]b Cursor backward one word. Page 20 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) [count]B Cursor to preceding blank separated word. [count]fc Find the next character c in the current line. [count]Fc Find the previous character c in the current line. [count]tc Equivalent to f followed by h. [count]Tc Equivalent to F followed by l. ; Repeats the last single character find command, f, F, t, or T. , Reverses the last single character find command. 0 Cursor to start of line. ^ Cursor to first non-blank character in line. $ Cursor to end of line. Search Edit Commands These commands access your command history. [count]k Fetch previous command. Each time k is entered the previous command back in time is accessed. [count]- Equivalent to k. [count]j Fetch next command. Each time j is entered the next command forward in time is accessed. [count]+ Equivalent to j. [count]G The command number count is fetched. The default is the least recent history command. /string Search backward through history for a previous command containing string. String is terminated by a "RETURN" or "NEW LINE". If string is null the previous string will be used. ?string Same as / except that search will be in the forward direction. n Search for next match of the last pattern to / or ? commands. N Search for next match of the last pattern to / or ?, but in reverse direction. Search history for the string entered by the previous / command. Text Modification Edit Commands These commands will modify the line. a Enter input mode and enter text after the current character. A Append text to the end of the line. Equivalent to $a. [count]cmotion c[count]motion Delete current character through the character that motion would move the cursor to and enter input mode. If motion is c, the entire line will be deleted and input mode entered. C Delete the current character through the end Page 21 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) of line and enter input mode. Equivalent to c$. S Equivalent to cc. D Delete the current character through the end of line. Equivalent to d$. [count]dmotion d[count]motion Delete current character through the character that motion would move to. If motion is d , the entire line will be deleted. i Enter input mode and insert text before the current character. I Insert text before the beginning of the line. Equivalent to the two character sequence ^i. [count]P Place the previous text modification before the cursor. [count]p Place the previous text modification after the cursor. R Enter input mode and replace characters on the screen with characters you type overlay fashion. rc Replace the current character with c. [count]x Delete current character. [count]X Delete preceding character. [count]. Repeat the previous text modification command. 8 Invert the case of the current character and 9~ advance the cursor. [count]_ Causes the count word of the previous command to be appended and input mode entered. The last word is used if count is omitted. * Causes an * to be appended to the current word and file name generation attempted. If no match is found, it rings the bell. Otherwise, the word is replaced by the matching pattern and input mode is entered. Other Edit Commands Miscellaneous commands. [count]ymotion y[count]motion Yank current character through character that motion would move the cursor to and puts them into the delete buffer. The text and cursor are unchanged. Y Yanks from current position to end of line. Equivalent to y$. u Undo the last text modifying command. U Undo all the text modifying commands performed on the line. [count]v Returns the command fc -e ${VISUAL:-${EDITOR:-vi}} count in the input Page 22 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) buffer. If count is omitted, then the current line is used. ^L Line feed and print current line. Has effect only in control mode. ^J (New line) Execute the current line, regardless of mode. ^M (Return) Execute the current line, regardless of mode. # Sends the line after inserting a # in front of the line and after each new-line. Useful for causing the current line to be inserted in the history without being executed. = List the filenames that match the current word if an asterisk were appended it. @letter Your alias list is searched for an alias by the name _letter and if an alias of this name is defined, its value will be inserted on the input queue for processing. Special Commands. The following simple-commands are executed in the shell process. Input/Output redirection is permitted. Unless otherwise indicated, the output is written on file descriptor 1. Commands that are preceded by one or two - are treated specially in the following ways: 1. Parameter assignment lists preceding the command remain in effect when the command completes. 2. They are executed in a separate process when used within command substitution. 3. Errors in commands preceded by -- cause the script that contains them to abort. - : [ arg ... ] The command only expands parameters. A zero exit code is returned. -- . file [ arg ... ] Read and execute commands from file and return. The commands are executed in the current Shell environment. The search path specified by PATH is used to find the directory containing file. If any arguments arg are given, they become the positional parameters. Otherwise the positional parameters are unchanged. alias [ -tx ] [ name[ =value ] ... ] Alias with no arguments prints the list of aliases in the form name=value on standard output. An alias is defined for each name whose value is given. A trailing space in value causes the next word to be checked for alias substitution. The -t flag is used to set and list tracked aliases. The value of a tracked alias is the full pathname corresponding to the given name. The Page 23 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) value becomes undefined when the value of PATH is reset but the aliases remained tracked. Without the -t flag, for each name in the argument list for which no value is given, the name and value of the alias is printed. The -x flag is used to set or print exported aliases. An exported alias is defined across sub-shell environments. Alias returns true unless a name is given for which no alias has been defined. bg [ %job ] This command is only built-in on systems that support job control. Puts the specified job into the background. The current job is put in the background if job is not specified. break [ n ] Exit from the enclosing for while until or select loop, if any. If n is specified then break n levels. continue [ n ] Resume the next iteration of the enclosing for while until or select loop. If n is specified then resume at the n-th enclosing loop. - cd [ arg ] - cd old new This command can be in either of two forms. In the first form it changes the current directory to arg. If arg is - the directory is changed to the previous directory. The shell parameter HOME is the default arg. The parameter PWD is set to the current directory. The shell parameter CDPATH defines the search path for the directory containing arg. Alternative directory names are separated by a colon (:). The default path is (specifying the current directory). Note that the current directory is specified by a null path name, which can appear immediately after the equal sign or between the colon delimiters anywhere else in the path list. If arg begins with a / then the search path is not used. Otherwise, each directory in the path is searched for arg. The second form of cd substitutes the string new for the string old in the current directory name, PWD and tries to change to this new directory. The cd command may not be executed by rsh. echo [ arg ... ] See echo(1) for usage and description. -- eval [ arg ... ] The arguments are read as input to the shell and the Page 24 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) resulting command(s) executed. -- exec [ arg ... ] If arg is given, the command specified by the arguments is executed in place of this shell without creating a new process. Input/output arguments may appear and affect the current process. If no arguments are given the effect of this command is to modify file descriptors as prescribed by the input/output redirection list. In this case, any file descriptor numbers greater than 2 that are opened with this mechanism are closed when invoking another program. exit [ n ] Causes the shell to exit with the exit status specified by n. If n is omitted then the exit status is that of the last command executed. An end-of-file will also cause the shell to exit except for a shell which has the ignoreeof option (See set below) turned on. -- export [ name ... ] The given names are marked for automatic export to the environment of subsequently-executed commands. -- fc [ -e ename ] [ -nlr ] [ first ] [ last ] -- fc -e - [ old=new ] [ command ] In the first form, a range of commands from first to last is selected from the last HISTSIZE commands that were typed at the terminal. The arguments first and last may be specified as a number or as a string. A string is used to locate the most recent command starting with the given string. A negative number is used as an offset to the current command number. If the flag -l, is selected, the commands are listed on standard output. Otherwise, the editor program ename is invoked on a file containing these keyboard commands. If ename is not supplied, then the value of the parameter FCEDIT (default /bin/ed) is used as the editor. When editing is complete, the edited command(s) is executed. If last is not specified then it will be set to first. If first is not specified the default is the previous command for editing and -16 for listing. The flag -r reverses the order of the commands and the flag -n suppresses command numbers when listing. In the second form the command is re- executed after the substitution old=new is performed. fg [ %job ] This command is only built-in on systems that support job control. If job is specified it brings it to the foreground. Otherwise, the current job is brought into the foreground. Page 25 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) jobs [ -l ] Lists the active jobs; given the -l options lists process id's in addition to the normal information. kill [ -sig ] process ... Sends either the TERM (terminate) signal or the specified signal to the specified jobs or processes. Signals are either given by number or by names (as given in /usr/include/signal.h, stripped of the prefix ``SIG''). The signal numbers and names are listed by 'kill -l'. If the signal being sent is TERM (terminate) or HUP (hangup), then the job or process will be sent a CONT (continue) signal if it is stopped. The argument process can be either a process id or a job. let arg ... Each arg is an arithmetic expression to be evaluated. All calculations are done as long integers and no check for overflow is performed. Expressions consist of constants, named parameters, and operators. The following set of operators, listed in order of decreasing precedence, have been implemented: - unary minus ! logical negation * / % multiplication, division, remainder + - addition, subtraction <= >= < > comparison == != equality inequality = arithmetic replacement Sub-expressions in parentheses () are evaluated first and can be used to override the above precedence rules. The evaluation within a precedence group is from right to left for the = operator and from left to right for the others. A parameter name must be a valid identifier. When a parameter is encountered, the value associated with the parameter name is substituted and expression evaluation resumes. Up to nine levels of recursion are permitted. The return code is 0 if the value of the last expression is non-zero, and 1 otherwise. -- newgrp [ arg ... ] Equivalent to exec newgrp arg .... print [ -Rnprsu[n ] ] [ arg ... ] Page 26 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) The shell output mechanism. With no flags or with flag -, the arguments are printed on standard output as described by echo(1). In raw mode, -R or -r, the escape conventions of echo are ignored. The -R option will print all subsequent arguments and options other than -n. The -p option causes the arguments to be written onto the pipe of the process spawned with |& instead of standard output. The -s option causes the arguments to be written onto the history file instead of standard output. The -u flag can be used to specify a one digit file descriptor unit number n on which the output will be placed. The default is 1. If the flag -n is used, no new-line is added to the output. pwd Equivalent to print -r - $PWD read [ -prsu[ n ] ] [ name?prompt ] [ name ... ] The shell input mechanism. One line is read and is broken up into words using the characters in IFS as separators. In raw mode, -r, a \ at the end of a line does not signify line continuation. The first word is assigned to the first name, the second word to the second name, etc., with leftover words assigned to the last name. The -p option causes the input line to be taken from the input pipe of a process spawned by the shell using |&. If the -s flag is present, the input will be saved as a command in the history file. The flag -u can be used to specify a one digit file descriptor unit to read from. The file descriptor can be opened with the exec special command. The default value of n is 0. If name is omitted then REPLY is used as the default name. The return code is 0 unless an end-of-file is encountered. An end-of-file with the -p option causes cleanup for this process so that another can be spawned. If the first argument contains a ?, the remainder of this word is used as a prompt when the shell is interactive. If the given file descriptor is open for writing and is a terminal device then the prompt is placed on this unit. Otherwise the prompt is issued on file descriptor 2. The return code is 0 unless an end-of-file is encountered. -- readonly [ name ... ] The given names are marked readonly and these names cannot be changed by subsequent assignment. -- return [ n ] Causes a shell function to return to the invoking script with the return status specified by n. If n is omitted then the return status is that of the last command executed. If return is invoked while not in a function or a . script, then it is the same as an Page 27 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) exit. set [ -aefhkmnostuvx ] [ -o option ... ] [ arg ... ] The flags for this command have meaning as follows: -a All subsequent parameters that are defined are automatically exported. -e If the shell is non-interactive and if a command fails, execute the ERR trap, if set, and exit immediately. This mode is disabled while reading profiles. -f Disables file name generation. -h Each command whose name is an identifier becomes a tracked alias when first encountered. -k All parameter assignment arguments are placed in the environment for a command, not just those that precede the command name. -m Background jobs will run in a separate process group and a line will print upon completion. The exit status of background jobs is reported in a completion message. On systems with job control, this flag is turned on automatically for interactive shells. -n Read commands but do not execute them. Ignored for interactive shells. -o The following argument can be one of the following option names: allexport Same as -a. errexit Same as -e. bgnice All background jobs are run at a lower priority. emacs Puts you in an emacs style in-line editor for command entry. gmacs Puts you in a gmacs style in-line editor for command entry. ignoreeof The shell will not exit on end-of-file. The command exit must be used. keyword Same as -k. markdirs All directory names resulting from file name generation have a trailing / appended. monitor Same as -m. noexec Same as -n. noglob Same as -f. nounset Same as -u. protected Same as -p. verbose Same as -v. trackall Same as -h. Page 28 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) vi Puts you in insert mode of a vi style in-line editor until you hit escape character 033. This puts you in move mode. A return sends the line. viraw Each character is processed as it is typed in vi mode. xtrace Same as -x. If no option name is supplied then the current option settings are printed. -p Resets the PATH variable to the default value, disables processing of the $HOME/.profile file and uses the file /etc/suid_profile instead of the ENV file. This mode is automatically enabled whenever the effective uid (gid) is not equal to the real uid (gid). -s Sort the positional parameters. -t Exit after reading and executing one command. -u Treat unset parameters as an error when substituting. -v Print shell input lines as they are read. -x Print commands and their arguments as they are executed. - Turns off -x and -v flags and stops examining arguments for flags. -- Do not change any of the flags; useful in setting $1 to a value beginning with -. If no arguments follow this flag then the positional parameters are unset. Using + rather than - causes these flags to be turned off. These flags can also be used upon invocation of the shell. The current set of flags may be found in $-. The remaining arguments are positional parameters and are assigned, in order, to $1 $2 .... If no arguments are given then the values of all names are printed on the standard output. - shift [ n ] The positional parameters from $n+1 ... are renamed $1 ... , default n is 1. The parameter n can be any arithmetic expression that evaluates to a non-negative number less than or equal to $#. test [ expr ] Evaluate conditional expression expr. See test(1) for usage and description. The arithmetic comparison operators are not restricted to integers. They allow any arithmetic expression. Four additional primitive expressions are allowed: -L file True if file is a symbolic link. Page 29 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) file1 -nt file2 True if file1 is newer than file2. file1 -ot file2 True if file1 is older than file2. file1 -ef file2 True if file1 has the same device and i-node number as file2. times Print the accumulated user and system times for the shell and for processes run from the shell. trap [ arg ] [ sig ] ... arg is a command to be read and executed when the shell receives signal(s) sig. (Note that arg is scanned once when the trap is set and once when the trap is taken.) Each sig can be given as a number or as the name of the signal. Trap commands are executed in order of signal number. Any attempt to set a trap on a signal that was ignored on entry to the current shell is ineffective. If arg is omitted or is -, then all trap(s) sig are reset to their original values. If arg is the null string then this signal is ignored by the shell and by the commands it invokes. If sig is ERR then arg will be executed whenever a command has a non-zero exit code. This trap is not inherited by functions. If sig is 0 or EXIT and the trap statement is executed inside the body of a function, then the command arg is executed after the function completes. If sig is 0 or EXIT for a trap set outside any function then the command arg is executed on exit from the shell. The trap command with no arguments prints a list of commands associated with each signal number. -- typeset [ -HLRZfilprtux[n ] [ name[ =value ] ] ... ] When invoked inside a function, a new instance of the parameter name is created. The parameter value and type are restored when the function completes. The following list of attributes may be specified: -H This flag provides UNIX to host-name file mapping on non-UNIX machines. -L Left justify and remove leading blanks from value. If n is non-zero it defines the width of the field, otherwise it is determined by the width of the value of first assignment. When the parameter is assigned to, it is filled on the right with blanks or truncated, if necessary, to fit into the field. Leading zeros are removed if the -Z flag is also set. The -R flag is turned off. -R Right justify and fill with leading blanks. If n is non-zero it defines the width of the field, otherwise it is determined by the width of the Page 30 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) value of first assignment. The field is left filled with blanks or truncated from the end if the parameter is reassigned. The L flag is turned off. -Z Right justify and fill with leading zeros if the first non-blank character is a digit and the -L flag has not been set. If n is non-zero it defines the width of the field, otherwise it is determined by the width of the value of first assignment. -f The names refer to function names rather than parameter names. No assignments can be made and the only other valid flags are -t, which turns on execution tracing for this function and -x, to allow the function to remain in effect across shell procedures executed in the same process environment. -i Parameter is an integer. This makes arithmetic faster. If n is non-zero it defines the output arithmetic base, otherwise the first assignment determines the output base. -l All upper-case characters converted to lower-case. The upper-case flag, -u is turned off. -p The output of this command, if any, is written onto the two-way pipe -r The given names are marked readonly and these names cannot be changed by subsequent assignment. -t Tags the named parameters. Tags are user definable and have no special meaning to the shell. -u All lower-case characters are converted to upper- case characters. The lower-case flag, -l is turned off. -x The given names are marked for automatic export to the environment of subsequently-executed commands. Using + rather than - causes these flags to be turned off. If no name arguments are given but flags are specified, a list of names (and optionally the values) of the parameters which have these flags set is printed. (Using + rather than - keeps the values to be printed.) If no names and flags are given, the names and attributes of all parameters are printed. ulimit [ -acdfmpst ] [ n ] -a Lists all of the current resource limits (BSD only). -c imposes a size limit of n 512 byte blocks on the size of core dumps (BSD only). -d imposes a size limit of n kbytes on the size of the data area (BSD only). -f imposes a size limit of n 512 byte blocks on files Page 31 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) written by child processes (files of any size may be read). -m imposes a soft limit of n kbytes on the size of physical memory (BSD only). -p changes the pipe size to n (UNIX/RT only). -s imposes a size limit of n kbytes on the size of the stack area (BSD only). -t imposes a time limit of n seconds to be used by each process (BSD only). If no option is given, -f is assumed. If n is not given the current limit is printed. umask [ nnn ] The user file-creation mask is set to nnn (see umask(2)). If nnn is omitted, the current value of the mask is printed. unalias name ... The parameters given by the list of names are removed from the alias list. unset [ -f ] name ... The parameters given by the list of names are unassigned, i. e., their values and attributes are erased. Readonly variables cannot be unset. If the flag, -f, is set, then the names refer to function names. wait [ n ] Wait for the specified child process and report its termination status. If n is not given then all currently active child processes are waited for. The return code from this command is that of the process waited for. whence [ -v ] name ... For each name, indicate how it would be interpreted if used as a command name. The flag, -v, produces a more verbose report. Invocation. If the shell is invoked by exec(2), and the first character of argument zero ($0) is -, then the shell is assumed to be a login shell and commands are read from /etc/profile and then from either .profile in the current directory or $HOME/.profile, if either file exists. Next, commands are read from the file named by performing parameter substitution on the value of the environment parameter ENV if the file exists. If the -s flag is not present and arg is, then a path search is performed on the first arg to determine the name of the script to execute. The script arg Page 32 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) must have read permission and any setuid and getgid settings will be ignored. Commands are then read as described below; the following flags are interpreted by the shell when it is invoked: -c string If the -c flag is present then commands are read from string. -s If the -s flag is present or if no arguments remain then commands are read from the standard input. Shell output, except for the output of the Special commands listed above, is written to file descriptor 2. -i If the -i flag is present or if the shell input and output are attached to a terminal (as told by ioctl(2)) then this shell is interactive. In this case TERM is ignored (so that kill 0 does not kill an interactive shell) and INTR is caught and ignored (so that wait is interruptible). In all cases, QUIT is ignored by the shell. -r If the -r flag is present the shell is a restricted shell. The remaining flags and arguments are described under the set command above. Rsh Only. Rsh is used to set up login names and execution environments whose capabilities are more controlled than those of the standard shell. The actions of rsh are identical to those of sh, except that the following are disallowed: changing directory (see cd(1)), setting the value of SHELL, ENV, or PATH, specifying path or command names containing /, redirecting output (> and >>). The restrictions above are enforced after .profile and the ENV files are interpreted. When a command to be executed is found to be a shell procedure, rsh invokes sh to execute it. Thus, it is possible to provide to the end-user shell procedures that have access to the full power of the standard shell, while imposing a limited menu of commands; this scheme assumes that the end-user does not have write and execute permissions in the same directory. The net effect of these rules is that the writer of the .profile has complete control over user actions, by performing guaranteed setup actions and leaving the user in an appropriate directory (probably not the login directory). The system administrator often sets up a directory of Page 33 (printed 6/5/86) SH(1) UNIX 5.0 SH(1) commands (i.e., /usr/rbin) that can be safely invoked by rsh. Some systems also provide a restricted editor red. EXIT STATUS Errors detected by the shell, such as syntax errors, cause the shell to return a non-zero exit status. Otherwise, the shell returns the exit status of the last command executed (see also the exit command above). If the shell is being used non-interactively then execution of the shell file is abandoned. Runtime errors detected by the shell are reported by printing the command or function name and the error condition. If the line number that the error occurred on is greater than one, then the line number is also printed in square brackets ([]) after the command or function name. FILES /etc/passwd /etc/profile /etc/suid_profile $HOME/.profile /tmp/sh* /dev/null SEE ALSO cat(1), cd(1), echo(1), emacs(1), env(1), gmacs(1), newgrp(1), test(1), umask(1), vi(1), dup(2), exec(2), fork(2), ioctl(2), lseek(2), pipe(2), signal(2), umask(2), ulimit(2), wait(2), rand(3), a.out(5), profile(5), environ(7). CAVEATS If a command which is a tracked alias is executed, and then a command with the same name is installed in a directory in the search path before the directory where the original command was found, the shell will continue to exec the original command. Use the -t option of the alias command to correct this situation. Some very old shell scripts contain a ^ as a synonym for the pipe character. |. If a command is piped into a shell command, then all variables set in the shell command are lost when the command completes. Using the fc built-in command within a compound command will cause the whole command to disappear from the history file. The built-in command . file reads the whole file before any commands are executed. Therefore, alias and unalias commands in the file will not apply to any functions defined in the file. Page 34 (printed 6/5/86) 0707070000020030171006660000000000020000010163070367132761400001100000202775ksh.memo AT&T Information Systems subject: Introduction to KSH ( date: June 5, 1986 Issue 3) Charge Case 311531-0101 from: David G. Korn File Case 49059-6 MH 59554 5D-112 x7975 (ulysses!dgk) TM 59554-860602-04 MEMORANDUM_FOR_FILE 1. Introduction Over the past several years several papers have been written describing new command interpreters for the UNIX system. These papers can be divided into two categories: Those that improve the shell as a programming language, and those that improve the shell as a command interpreter. Most of the papers fall into the latter category. In particular, vicmd[3] preserves the friendly environment of vi (from which this memo was entered), and adds a facility for convenient command entry. An emacs oriented shell has also been written by Veach[4]. The 2dsh[5] shell allows the setup of more complicated networks of processes than just pipelines. The never developed See-shell[6] proposes a Small-Talk like interface[7] suitable for bit-mapped terminals such as the BLIT[8] and the Apollo[9]. Perhaps the most widely used shell, other than the Bourne shell, is Csh, which runs under the Berkeley UNIX operating system. Csh has many attractive command interpreter features not currently in the Bourne shell; most notably, job control, history, arithmetic, and command name aliasing. On the other hand, many people (including this author), think that the Bourne shell is superior as a programming language. The history mechanism of Csh has recently been added as a local modification to the Bourne shell by J. L. Steffen[10]. The use of the shell as a programming language has been described by Dolotta and Mashey[11] and has been used by many people here at Bell Laboratories. Kolettis[12] presented extensions to the Bourne shell to provide message passing facilities and other inter-process communication and synchronization features. The Form shell[13] added form entry/edit capabilities to the Bourne shell. A proposal for a more programming language oriented shell has been proposed by Sturzenbecker[14]. - 2 - This memo describes Ksh, aka the Korn-shell. This memo is not a tutorial, only an introduction. Another description of Ksh can be found in Kochan and Wood[15]. Ksh is a direct descendant of the Form shell with most of the form entry/edit features removed and with many new features added. The primary focus of this work has been to provide an enhanced programming environment in addition to the major command entry features of Csh. Improved performance has been a major objective. Many of the additions have been provided so that medium sized programming tasks can be written at the shell level without a serious performance penalty. A concerted effort has been made to achieve System V Bourne shell compatibility so that scripts written for the Bourne shell can run without modification with Ksh. The description of features in this memo assumes that the reader is already familiar with the Bourne shell. A version of Ksh has been run on several machines including but not limited to VAXEN , PDP-11's, IBM-370's, AT&T 3B's, UNIX-PC, PC-6300+, Suns, Alliant, CCI, Sequent, Pyramid, and Apollo Domain. It has been run on top of several versions of the UNIX operating system including Venix, Xenix, System III, System V, UTS, BSD 4.1, 4.2, 4.3, 8th. Edition, and DOMAIN/IX. The shell is in use in several centers at AT&T Bell Laboratories, and has been installed as /bin/sh on VAXEN running System V, BSD 4.1., BSD 4.2, 3B's, PC-6300+, and UNIX-PC's running System V. 2. Shell Variables The ability to define and use variables to store and retrieve values is an important feature in most programming languages. Ksh has variables with identifier names that follow the same rules as the Bourne shell. Since all variables have string representations, there is no need to specify the type of each variable in the shell. In Ksh, each variable can have one or more attributes that control the internal representation of the variable, the way the variable is printed, and its access or scope. Two of the attributes, readonly and export, are available in the Bourne shell. The typeset built-in command of Ksh assigns attributes to variables. The complete list of attributes, some of which are discussed here, appears in the manual page. The unset built-in of the Ksh removes values and attributes of parameters. Whenever a value is assigned to a variable, the value is transformed according to the attributes of the variable. Changing the attribute of a variable can change its value. There are three attributes for field justification, as might - 3 - be needed for formatting a report. For each of these attributes, a width can be defined explicitly or else it is defined the first time an assignment is made to the variable it Each assignment causes justification of the field, truncating if necessary. Assignment to fixed sized variables provides a simple way to generate a substring consisting of a fixed number of characters from the beginning or end of a string. The attributes -u and -l, are used for upper case and lower case formatting respectively. Since it makes no sense to have both attributes on simultaneously, turning on either of these attributes turns the other off. The following script provides an example of the use of shell variables with attributes. This script reads a file of lines each consisting of five fields separated by : and prints fields 4 and 2 in upper case in columns 1-15, left justified, and columns 20-25 right-justified respectively. typeset -L15u f4 # 15 character left justified typeset -R6u f2 # 6 character right justified IFS=: set -f # skip file name generation while read -r f1 f2 f3 f4 f5 # read line, split into fields do print -r "$f4 $f2" # print fields 4 and 2 done The integer attribute, -i, causes the variable to be internally represented as an integer. The i can be followed by a number representing the numeric base for printing, otherwise the first assignment to an integer variable defines the output base (see below). This base will be used whenever the variable is printed. Assignment to integer typed variables result in arithmetic evaluation, as described below, of the right hand side. Ksh allows one-dimensional arrays in addition to simple variables. Any variable can become an array by referring to it with a subscript. All elements of an array need not exist. Subscripts for arrays must evaluate to an integer between 0 and 511, otherwise an error results. Evaluation of subscripts is described in the next section. Attributes apply to the whole array. Assignments to array variables can be made with parameter assignment statements or with the typeset built-in. Referencing of subscripted variables requires the character $, but also requires braces around the array element name. The braces are needed to avoid conflicts with the file name generation mechanism. The form of any array element - 4 - reference is: ${name[subscript]}. A subscript value of * or @ can be used to generate all elements of an array, as they are used for expansion of positional parameters. A few additional operations are available on shell variables. ${#name} will be the length in bytes of $name. For an array variable ${#name[*]} gives the number of elements in the array. There are four parameter substitution modifiers that have been added to strip off leading and trailing substrings during parameter substitution. The modifier #(##) strips off the smallest (largest) matching pattern from the left and the modifier %(%%) strips off the smallest (largest) matching pattern from the right. For example, if the shell variable i has value file.c, then the expression ${i%.c}.o has value file.o. 3. Arithmetic Evaluation The built-in command, let, provides the ability to do integer arithmetic. All arithmetic evaluations are performed using long arithmetic. Arithmetic constants are written as base#number where base is a decimal integer between two and thirty-six and number is any non-negative number. Anything after a decimal point is truncated. Base ten is used if no base is specified. Arithmetic expressions are made from constants, variables, and one or more of the fourteen operators listed in the manual page. Operators are evaluated in order of precedence. Parentheses may be used for grouping. A variable does not have to have an integer attribute to be used within an arithmetic expression. The name of the variable is replaced by its value within an arithmetic expression. The statement let x=x+1 can be used to increment a variable x. Note that there is no space before or after the operators + and =. This is because each argument to let is an expression to evaluate. The last expression determines the value returned by let. Let returns true if the last expression evaluates to a non- zero value. Otherwise, let returns false. Many of the arithmetic operators have special meaning to the shell and must be quoted. Since this can be burdensome, an - 5 - alternate form of arithmetic evaluation syntax has been provided. For any command that begins with ((, all the characters until the matching )) are treated as a quoted arithmetic expression. The double parentheses usually avoids incompatibility with the Bourne shell's use of parentheses for grouping a set of commands to be run in a sub-shell. Expressions inside double parentheses can contain blanks and special characters without quoting. More precisely, (( ... )) is equivalent to let " ... " The following script prints the first n lines of its standard input onto its standard output, where n can be supplied as an optional argument whose default value is 20. typeset -i n=${1-20} # set n while read -r line && (( (n=n-1)>=0 ))# at most n lines do print -r - "$line" done 4. Functions and Command Aliasing Two new mechanisms have been provided for creating pseudo- commands, i. e., things that look like commands, but do not always create a process. The first technique is called command name aliasing. As a command is being read, the command name is checked against a list of alias names. If it is found, the name is replaced by the text associated with the alias and then rescanned. The text of an alias is not checked for aliases so recursive definitions are not allowed. However, if the value of an alias ends in a space, then the word following the alias is also checked for alias substitution. Aliases are defined with the alias built-in. The form of an alias command definition is: alias name=value The first character of an alias name can be any non-special printable character, while all remaining characters must be alpha-numeric. The replacement text, value, can contain any valid shell script, including meta-characters such as pipe symbols and i/o-redirection. Unlike csh, aliases in ksh cannot take arguments. Aliases can be used to redefine built-in commands so that the alias alias test=./test can be used to look for test in your current working - 6 - directory rather than using the built-in test command. Keywords such as for and while cannot be changed by aliasing. The command alias, without arguments, generates a list of aliases and corresponding texts. The unalias command removes the name and text of an alias. Aliases are used to save typing and to improve readability of scripts. For example, the alias alias integer='typeset -i' allows integer the variables i and j to be declared and initialized with the command integer i=0 j=1. Aliases can be used to bind program names to the full path- name of the program. This eliminates the path search but requires knowledge of where that program will be stored. Tracked aliases make this use for aliasing automatic. A tracked alias is not given a value. Its value is defined at the first reference by a path-search as the full path-name equivalent of the name, and remains defined until the PATH variable is changed. Programs found in directories that do not begin with / that occur earlier in the path-search than the value of the tracked alias, take precedence over tracked aliases. Tracked aliases provide an alternative to the Csh command hashing facility. Tracked aliases do not require time for initialization and allow for new commands to be introduced without the need for re-hashing. The -h option to the shell allows all command names that are valid alias names to become tracked aliases. This option is automatically turned on for non-interactive shells. Functions are more general than aliases but also more costly. Functions definitions are of the form function name { any shell script } The function is invoked by writing name and optionally following it with arguments. Positional parameters are saved before each function call and restored when completed. Functions are executed in the current shell environment and can share named variables with the calling program. Options, other than execution trace -x, set by the calling program are passed down to a function. The option flags are not shared with the function so that any options set within a function are restored when the function exits. All traps other than EXIT and ERR (described later) are also inherited. A trap on EXIT within a function will execute after the function completes but before the caller resumes. - 7 - Therefore, any variable assignments and any options set as part of a trap action will be effective after the caller resumes. The return built-in can be used to cause the function to return to the statement following the point of invocation. By default, variables are inherited by the function and shared by the calling program. However, environment substitutions preceding the function call apply only to the scope of the function call. Also, variables defined with the typeset, built-in command are local to the function that they are declared in. Thus, for the function defined function name { typeset -i x=10 let z=x+y print $z } invoked as y=13 name, x and y are local variables with respect to the function name while z is global. Alias and function names are never directly carried across separate invocations of Ksh, but can be passed down to sub- shells. Ordinarily, shell scripts invoked by name are executed in a sub-shell while scripts invoked as ksh script and shell escapes from other programs are carried out by a separate shell invocation. The -x flag is used with alias to carry aliases to sub-shells while the -fx flags of typeset are used to do the same for functions. Each user can create a startup file for aliases and functions or any other commands. Aliases and functions that are to be available for all shell invocations should be put into this file. Aliases and functions which should apply to scripts, as well as interactive use, should be set with the -x flag. Setting this flag to redefine the semantics of a command can have undesired side effects. For example, alias -x ls='ls -l' will cause shell procedures which use the ls command within a pipeline to break. By setting and exporting the environment variable, ENV, to the name of this file, the aliases and functions will be defined each time Ksh is invoked. The value of the ENV variable undergoes parameter substitution prior to its use. Several of the UNIX commands can be aliased to Ksh built- ins. Some of these are automatically set each time the shell is invoked. In addition, about twenty frequently used UNIX commands are set as tracked aliases. - 8 - The location of an alias command can be important since aliases are only processed when a command is read. A . procedure is read all at once (unlike profiles which are read a command at a time) so that any aliases defined there will not effect any commands within this script. A name is checked to see if it is a built-in command before checking to see if it is a function. To write a function to replace a built-in command you must define a function with a different name and alias the built-in name to this function. For example to write a cd function which changes the directory and prints out the directory name, you can write, alias cd=_cd function _cd { if 'cd' "$@" then echo $PWD fi } The single quotes around cd within the function prevents alias substitution. The PWD variable is described below. The combination of aliases and functions can be used to do things that can't be done with either of these separately. For example, the function and aliases defined as function _from # i=start to finish [ by incr] { typeset var=${1%%=*} integer incr=${5-1} $1 while (( $var <= $3 )) do _repeat let $var=$var+incr done } alias repeat='function _repeat {' from='}; _from' allow you to write loops such as repeat any script command from i=1 to 13 by 3 with the expected behavior. - 9 - 5. Input and Output An extended I/O capability has been added to enhance the use of the shell as a programming language. The Bourne shell has a built-in read for reading lines from file descriptor 0, but does not have any internal output mechanism. As a result, the echo(1) command has been used to produce output for a shell procedure. This is inefficient and also restrictive. For example, there is no way to read in a line from a terminal and to echo the line exactly as is. In the Bourne shell, the read built-in cannot be used to read lines that end in `\', and the echo command will treat certain sequences as control sequences. In addition, there is no way to have more than one file open at any time for reading. Ksh has options on the read command to specify the file descriptor for the input. The exec built-in can be used to open, close, and duplicate file streams. The -r option allows a `\' at the end of an input line to be treated as a regular character rather than the line continuation character. The first argument of the read command can be followed by a ? and a prompt to produce a prompt at the terminal before the read. If the input is not from a terminal device then the prompt is not issued. The Ksh built-in, print, is used to output characters to the terminal or to a file. Again, it is possible to specify the file descriptor number as an option to the command. Ordinarily, the arguments to this command are processed the same as for echo(1). However, the -r flag can be used to output the arguments without any special meaning. The -n flag can be used here to suppress the trailing new-line that is ordinarily appended. To improve performance of existing shell programs, the echo command is built into Ksh. For the System V version of Ksh, the built-in echo is equivalent print -, where the - signifies that there are no more options permitted. On the Berkeley UNIX version the value of the PATH variable determines the behavior of the built-in echo command. If echo would resolve to /bin/echo with a path search, then echo is equivalent to print -R. The -R option allows only the -n flag to be recognized as the next argument. Otherwise, echo behaves like the System V echo command. The shell is frequently used as a programming language for interactive dialogues. The select statement has been added to the language to make it easier to present menu selection - 10 - alternatives to the user and evaluate the reply. The list of alternatives is numbered and put in columns. A user settable prompt, PS3, is issued and if the answer is a number corresponding to one of the alternatives, the select loop variable is set to this value. In any case, the REPLY variable is used to store the user entered reply. The shell variables LINES and COLUMNS are used to control the layout of select lists. 6. Command Re-entry An interactive shell saves the commands you type at a terminal in a file. If the variable HISTFILE is set to the name of a file to which the user has write access, then the commands are stored in this history file. Otherwise the file $HOME/.sh_history is checked for write access and if this fails an unnamed file is used to hold the history lines. This file may be truncated if this is a top level shell. The number of commands accessible to the user, is determined by the value of the HISTSIZE variable at the time the shell is invoked. The default value is 128. A command may consist of one or more lines since a compound command is considered one command. If the character ! is placed within the primary prompt string, PS1, then it is replaced by the command number each time the prompt is given. Whenever the history file is named, all shells which use this file share access to the same history. A built-in command fc (fix command) is used to list and/or edit any of these saved commands. The command can always be specified with a range of one or more commands. The range can be specified by giving the command number, relative or absolute, or by giving the first character or characters of the command. The option -l is used to specify listing of previous commands. When given without specifying the range, the last 16 commands are listed, each preceded by the command number. If the listing option is not selected, then the range of commands specified, or the last command if no range is given, is passed to an editor program before being re- executed by Ksh. The editor to be used may be specified with the option -e and following it with the editor name. If this option is not specified, the value of the shell variable FCEDIT is used as the name of the editor, providing that this variable has non-null value. If this variable is not set, or is null, and the -e option has not been selected, then /bin/ed is used. When editing has been complete, the edited text automatically becomes the input for Ksh. As this text is read by Ksh, it is echoed onto the - 11 - terminal. An editor name of - is used to bypass the editing and just re-execute the command. In this case only a single command can be specified as the range and an optional argument of the form old=new may be added which requests a simple string substitution prior to evaluation. A convenient alias, alias r='fc -e -' has been pre-defined so that the single key-stroke r can be used to re-execute the previous command and the key-stroke sequence, r abc=def c can be used to re-execute the last command that starts with the letter c with the first occurrence of the string abc replaced with the string def. Typing r c > file re-executes the most recent command starting with the letter c, with standard output redirected to file. 7. In-line editing Lines typed from a terminal frequently need changes made before entering them. With the Bourne shell the only method to fix up commands is by backspacing or killing the whole line. Ksh offers options that allow the user to edit parts of the current command line before submitting the command. The in-line edit options make the command line into a single line screen edit window. When the command is longer than the width of the terminal, only a portion of the command is visible. Moving within the line automatically makes that portion visible. Editing can be performed on this window until the return key is pressed. The editing modes have commands that access the history file in which previous commands are saved. A user can copy any of the most recent HISTSIZE commands from this file into the input edit window. You can locate commands by searching or by position. The in-line editing options do not use the termcap database. They work on most standard terminals. They only require that the backspace character moves the cursor left and the space character overwrites the current character on the screen and moves the cursor to the right. There is a choice of editor options. The emacs, gmacs, or vi option is selected by turning on the corresponding option of the set command. If the value of the EDITOR or VISUAL ends any of these suffixes the corresponding options is turned on. A large subset of each of each of these editors' features are available within the shell. Additional functions, such as file name completion, have also been added. - 12 - The code for the emacs and gmacs editing option was supplied by Mike Veach. In the emacs or gmacs mode the user positions the cursor to the point needing correction and inserts, deletes, or replaces characters as needed. The only difference between these two modes is the meaning of the command ^T. Control keys and escape sequences are used for cursor positioning and control functions. The available editing functions are listed in the manual page. The code for the vi editing option was supplied by Pat Sullivan. The vi editing mode starts in insert mode and enters control mode when the user types ESC( 033). The return key, which submits the current command for processing, can be entered from either mode. The cursor can be anywhere on the line. A subset of commonly used vi commands are available. The k and j command that normally move up and down by one line, move up and down one command in the history file, copying the command into the input edit window. For reasons of efficiency, the terminal is kept in canonical mode until an ESC is typed. On some terminals, and on earlier versions of the UNIX operating system, this doesn't work correctly. The viraw option of the set command, which always uses raw or cbreak mode, must be used in this case. Most of the code for the editing options does not rely on the Ksh code and be used in a stand-alone mode with most any command to add in-line edit capability. However, all versions of the in-line editors have some features that use some shell specific code. For example, ESC-= in all edit modes prints the names of files that match the current word and ESC-* adds the expanded list of matching files to the command line. A trailing * is added to the word if it doesn't contain any file pattern matching characters before the expansion. 8. Job Control The job control mechanism is almost identical to the version found in Csh of the Berkeley UNIX operating system, version 4.1. The job control feature allows the user to stop and restart programs, and to move programs to and from the foreground and the background. It will only work on systems that provide support for these features. However, even systems without job control have a monitor option which when enabled will report the progress of background jobs and enable the user to kill jobs by job number or job name. An interactive shell associates a job with each pipeline typed in from the terminal and assigns them a small integer - 13 - number called the job number. If the job is run asynchronously, the job number is printed at the terminal. At any given time, only one job owns the terminal, i. e., keyboard signals are only sent to the processes in one job. When Ksh creates a foreground job, it gives it ownership of the terminal. If you are running a job and wish to stop it you hit the key ^Z (control-Z) which sends a STOP signal to all processes in the current job. The shell receives notification that the processes have stopped and takes back control of the terminal. There are commands to continue programs in the foreground and background. There are several ways to refer to jobs. The character % introduces a job name. You can refer to jobs by name or number as described in the manual page. The built-in command bg allows you to continue a job in the background, while the built-in command fg allows you to continue a job in the foreground even though you may have started it in the background. A job being run in the background will stop if it tries to read from the terminal. It is also possible to stop background jobs that try to write on the terminal by setting the terminal options appropriately. There is a built-in command jobs that lists the status of all running and stopped jobs. In addition, you are notified of the change of state of any background jobs just before each prompt. When you try to leave the shell while jobs are stopped or running, you will receive a message from Ksh. If you ignore this message and try to leave again, all stopped processes will be terminated. A built-in version of kill makes it possible to use job numbers as targets for signals. Signals can be selected by number or name. The name of the signal is the name found in the include file /usr/include/signal.h with the prefix SIG removed. The -l flag of kill generates list of valid signal numbers and names. 9. Security There are several documented problems associated with the security of shell procedures[16]. These security holes occur primarily because a user can manipulate the environment to subvert the intent of a setuid shell procedure. Frequently, shell procedures are initiated from binary programs, without the author's awareness, by library routines which invoke shells to carry out their tasks. When the binary program is run setuid then the shell procedure - 14 - runs with the permissions afforded to the owner of the binary file. In the Bourne shell, the IFS parameter is used to split each word into separate command arguments. If a user knows that some setuid program will run sh -c /bin/pwd (or any other command in /bin) then the user sets and exports IFS=/. Instead of running /bin/pwd the shell will run bin with pwd as an argument. The user puts his or her own bin program into the current directory. This program can create a copy of the shell, make this shell setuid, and then run the /bin/pwd program so that the original program continues to run successfully. This kind of penetration is not possible with Ksh since the IFS parameter only splits arguments that result from command or parameter substitution. Some setuid programs run programs using system() without giving the full path name. If the user sets the PATH variable so that the desired command will be found in his or her local bin, then the same technique described above can be employed to compromise the security of the system. To close up this and other security holes, Ksh goes into a protected mode whenever the real and effective user or group id are not the same. In this mode, the PATH variable is reset to a default value and the .profile and ENV files are not processed. Instead, the file /etc/suid_profile is read and executed. This gives an administrator control over the environment to set the PATH variable or to log setuid shell invocations. Clearly security of the system is compromised if /etc or this file is publicly writable. In BSD UNIX the operating system looks for the characters #! as the first two characters of an executable file. If these characters are found, then the next word on this line is taken as the interpreter to exec for this command and the interpreter is execed with the name of the script as argument zero and argument one. If the setuid or setgid bits are on for this file, then the interpreter is run with the effective uid and/or gid set accordingly. This scheme has two major drawbacks. First of all, using the #! notation forces an exec of the interpreter even when the call is invoked from the interpreter which it must exec. This is inefficient since the interpreter can handle a failed exec much faster than starting up again. More importantly, setuid and setgid procedures provide an easy target for intrusion. By linking a setuid or setgid procedure to a name beginning with a - the interpreter is fooled into thinking that is being invoked with a command line option rather than the name of a file. When the interpreter is the shell, the user gets a privileged interactive shell. There is code in Ksh to guard against - 15 - this simple form of intrusion. A more reliable way to handle setuid and setgid procedures is provided with Ksh. The technique does not require any changes to the operating system and provides better security. Another advantage to this method is that it also allows scripts which have execute premission but no read permission to run. Taking away read permission makes scripts more secure. The method relies on a setuid root program to authenticate the request and exec the shell with the correct mode bits to carry out the task. This shell is invoked with the requested file already open for reading. A script which cannot be opened for reading or which has its suid and/or setgid bits turned on causes this setuid root program to get execed. For security reasons, this program is given the full pathname /etc/suid_exec. A description of the implementation of the suid_exec program can be found in a separate paper[17]. 10. Miscellaneous Ksh has several additional features to enhance functionality and performance. This section lists most of these features. 10.1 Tilde substitution The character 8 at the beginning of a word has special meaning to Ksh. If the characters after the 8 up to a / match a user login name in the /etc/passwd file,9then the 8 and the name are replaced by that user's login directory. If no match is found, the original word is unchanged. A 8 by itself, or in front of a /, is replaced by the value of the HOME parameter. A 8 followed by a + or - is replaced by the value of the parameter PWD and OLDPWD respectively. Tilde substitution takes place when the script is read, not while it is executed. 10.2 Built-in I/O Redirection All built-in commands can be redirected. Compound commands which are redirected are not carried out in a separate process. - 16 - 10.3 Added options Several options have been added to the shell and all options have names that can be used in place of flags for setting and resetting options. The command set -o will list the current option settings. The option, -f or noglob, is used to disable file name generation. The option ignoreeof can be used to prevent ^D from exiting the shell and possibly logging you out. You must type exit to log out. The -h or trackall option will cause all commands whose name is a valid alias name to become a tracked alias. This option is automatically turned on for non-interactive shells. The job monitor option will cause a report to be printed before issuing the next prompt when each background job completes. It is automatically enabled for systems that have job control. If the bgnice option is set, background jobs are run at a lower priority. The option markdirs causes a trailing / to be appended on every directory name resulting from a pattern match. The protected or -p options provides additional security by disabling the ENV from being executed and by resetting the PATH variable to the default value. Whenever a shell is run with the effective uid (gid) not equal to the real uid (gid) then this option is implicitly enabled. Instead of the ENV file, the file /etc/suid_profile is read so that administrators can have control over setuid scripts. 10.4 Built-in pwd The pwd command is built-into ksh and therefore much faster. 10.5 Logical naming The cd command will take you where you expect to go even if you cross symbolic links. Thus, cd .. will move you up one level closer to the root even if your current directory is a symbolic link. - 17 - 10.6 Previous Directory Ksh remembers your last directory in the variable OLDPWD. The cd built-in can be given with argument - to return to the previous directory and prints the name of the directory. Note that cd - done twice returns you to the starting directory, not the second previous directory. A directory stack manager has been written as shell functions to push and pop directories from the stack. 10.7 Additional Variables and Parameters Several new parameters have special meaning to Ksh. The variable PWD is used to hold the current working directory of the shell. The variable OLDPWD is used to hold the previous working directory of the shell. The variable FCEDIT is used by the fc built-in described above. The variables VISUAL and EDITOR are used for determining the edit modes as described above. The variable ENV is used to define the startup file for non-login Ksh invocations. The variables HISTSIZE and HISTFILE control the size and location of the file containing commands entered at a terminal. The parameter MAILPATH is a colon ( : ) separated list of file names to be checked for changes periodically. The user is notified before the next prompt. Each of the names in this list can be followed by a ? and a prompt to be given when a change has been detected in the file. The prompt will be evaluated for parameter substitution. The parameter $_ within a mail message will evaluate to the name of the file that has changed. The parameter MAILCHECK is used to specify the minimal interval in seconds before new mail is checked for. The variable RANDOM produces a random number each time it is referenced. Assignment to this variable sets the seed for the random number generator. The variable SECONDS is incremented every second. In a roundabout way, this variable can be used to generate a time stamp into the PS1 prompt. The following code explains how you can do this on System V. On BSD you need another command to initialize the SECONDS variable. # If you . this script then you can use $TIME as part of your PS1 string to get # the time of day in your prompt - 18 - typeset -RZ2 _x1 _x2 _x3 let SECONDS=$(date '+3600*%H+60*%M+%S') _s='(_x1=(SECONDS/3600)%24)==(_x2=(SECONDS/60)%60)==(_x3=SECONDS%60)' TIME='"${_d[_s]}$_x1:$_x2:$_x3"' # PS1=${TIME}whatever The parameter PPID is used to generate the process id of the process which invoked this shell. The value of the parameter _ is the last argument of the previous foreground command. Before execing each command this parameter is set to the file name of the command and placed in the environment. The parameter TMOUT can be set to be the number of seconds that the shell will wait for input before terminating. A 60 second warning message is printed before terminating. The COLUMNS variable can be used to adjust the width of the edit window for the in-line edit modes. It is also used by the select command to present menu choices. The LINES variable controls how many rows a select list will take up on the screen. Select lists will try to occupy no more then two-thirds of LINES lines on the screen. 10.8 Modified variables The input field separator parameter, IFS, is only used to split words that have undergone parameter or command substitution. In addition, adjacent non-blank delimiters separate null fields in Ksh. The PS1 parameter is evaluated for parameter substitution and a ! is replaced by the current command number. 10.9 Timing Commands A keyword time has been added to replace the time command. Any function, command or pipeline can be preceded by this keyword to obtain information about the elapsed, user and system times. Since I/O redirection bind to the command, not to time, parenthesis should be used to redirect the timing information which is normally printed on file descriptor 2. - 19 - 10.10 Co-process Ksh can spawn a co-process by adding a |& after a command. This process will be run with its standard input and its standard output connected to the shell. The built-in command print with the -p option will write into the standard input of this process and the built-in command read with the -p option will read from the output of this process. Only one such process can exist at any time. 10.11 Process Substitution This feature is only available on versions of the UNIX operating system which support the /dev/fd directory for naming open files. Each command argument of the form (list), <(list), or >(list) will run process list asynchronously connected to some file in the /dev/fd directory. The name of this file will become the argument to the command. If the form with > is selected then writing on this file will provide input for list. If < is used or omitted, then the file passed as an argument will contain the output of the list process. For example, paste (cut -f1 file1) (cut -f3 file2) | tee >(process1) >(process2) cuts fields 1 and 3 from the files file1 and file2 respectively, pastes the results together, and sends it to the processes process1 and process2, as well as putting it onto the standard output. Note that the file which is passed as an argument to the command is a UNIX pipe(2) so that the programs that expect to lseek(2) on the file will not work. 10.12 Command Substitution Command substitution ( ``) in the Bourne shell suffers from some complicated quoting rules. It is hard to write a sed pattern which contains back slashes within command substitution. Putting the pattern is single quotes doesn't help much. Ksh leaves the Bourne shell command substitution alone and adds a newer and easier to use command substitution syntax. All the characters between a $( and a matching ) are evaluated as a command the output is substituted just as with ``. The $ means value of and the () denotes a command. The command itself can contain quoted strings even if the substitution occurs within double quotes. Nesting is legal. You can use unbalanced parenthesis within the command providing that they are quoted. - 20 - The special command substitution of the form $(cat file) can be replaced by $(< file), which is faster because no separate process is created. 10.13 Whence The addition of aliases, functions, and more built-ins has made it substantially more difficult to know what a given command word really means. A built-in command, whence when used with the -v option has been provided to answer this question. A line is printed for each argument to whence telling what would happen if this argument were used as a command name. It reports on keywords, aliases, built-ins, and functions. If the command is none of the above, it follows the path search rules and prints the full path-name, if any, otherwise it prints an error message. 10.14 Additional test operators The binary operators -ot and -nt can be used to compare the modification times of two files to see which is file is older than or newer than the other. The binary operator -ef is used to see if two files have the same device and i-node number, i. e., a link to the same file. The unary operator -L returns true for a symbolic link. 10.15 Added Trap All traps can be given by name in Ksh. The names of traps corresponding to signals are the same as the signal name with the SIG prefix removed. The trap 0 is named EXIT and a new trap named ERR has been added. This trap is invoked whenever the shell would exit if the -e flag were set. This trap is used by Fourth Generation Make[18] which runs Ksh as a co-process. 10.16 Shell Accounting There is a compile time option to the shell to generate an accounting message for each shell script. The changes needed to provide this feature were supplied by Foregger[19] and have been adopted as described in his memo. 10.17 Coded in Standard C Early versions of Bourne shell were coded in an ALGOL-68 like dialect of C. Ksh is coded in standard C. It tries to adapt itself to the environment when it is compiled taking advantages of the features of the host environment when possible. There are far fewer lint messages from Ksh then - 21 - for the Bourne shell. Ksh does not catch the segmentation violation signal, SIGSEGV, so that it can run on machines that can't recover from these traps. 10.18 Internationization Ksh treats eight bit characters transparently without stripping off the leading bit. There is also a compile time switch to enable handling multi-byte and multi-width characters sets. 10.19 No special meaning for ^ The Bourne shell uses ^ as an archaic synonym for |. The ^ is not a special character to Ksh. 10.20 Added conveniences You can refer to multi-digit positional parameters in Ksh by putting the number in braces. Thus, ${12} is legal in Ksh but illegal in the Bourne shell. Ksh will perform file name expansion of file name arguments if the expansion is unique. Thus, cat < file* will expand the file name if the expansion is unique. If you invoke the shell as ksh script then Ksh will do a path search on script. Unbalanced quotes will cause the shell to print an error message giving the type of quote and the line number on which the opening quote occurs. Run time error messages detected by the shell will print the line number within a function or script where the error was detected. 11. Example An example of a Ksh script is included in the Appendix. This one page program is a variant of the UNIX grep(1) program. Pattern matching for this version of grep means shell patterns consisting of ?, *, and []. The first half examines option flags. Note that all options except -b have been implemented. The second half goes through each line of each file to look for a pattern match. This program is not intended to serve as a replacement for grep; just as an illustration of the programming power of - 22 - Ksh. Note that no auxiliary processes are spawned by this script. It was written and debugged in under two hours. While performance is acceptable for small programs, this program runs at only one tenth the speed of grep for large files. 12. Performance Ksh executes many scripts faster than the System V Bourne shell. One major reason is that many of the functions provided by echo(1) and expr(1) are built-in. The time to execute a built-in function is one or two orders of magnitude faster than performing a fork and execute of the shell. Command substitution of built-ins is performed without creating another process, and often without even creating a temporary file. Another reason for improved performance is that all I/O is buffered. Output buffers are flushed only when required. Several of the internal algorithms have been changed so that the number of subroutine calls has been substantially reduced. Ksh uses hash tables for variables. Scripts that rely heavily on referencing variables execute faster. More processing is performed while reading the script so that execution time is saved while running loops. Scripts that do little internal processing and create many processes may run a little slower on System V because the time to fork Ksh is slightly slower than for the Bourne shell. On BSD Unix, Ksh can be compiled with a VFORK option which uses vfork whenever possible. In this case, binary programs startup somewhat faster but shell script files start a little slower since a separate invocation of the Ksh in required. The ENV file can have an undiserable effect on performance. Even if this file is small, the shell must perform an open of this file. If large functions are placed in the ENV file they must be read in and compiled even if they are never referenced. If you only need the startup file for interactive shells only, then set your ENV variable to a value which evaluates to a file name for interactive shells and to the null string otherwise. If you export the startup file name in the variable START, then setting ENV='${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}' will only invoke the startup file for interactive shells since the subscript evaluates to 0 only if the shell is interactive. - 23 - If you need a startup ENV file for all shells then use a case statement on the $- parameter to distinguish which actions only apply to interactive shells. The ENV file should look like # options aliases and functions for all shell invocations case $- in *i*) # options aliases and functions for interactive only ;; esac If there are functions which are only occasionally referenced, put them into a separate file $HOME/functions or any name you prefer and put aliases in the ENV file for each function name of the form alias function_name='. $HOME/functions;function_name' In the beginning of the $HOME/functions file you must unalias each of the function names defined in the file. The first reference to any function_name in the function file causes the function file to get read in and the functions compiled. 13. Conclusion Ksh has several thousand regular users. Ksh is a suitable replacement for the Bourne shell. It offers new features, better performance, and is essentially upward compatible with the Bourne shell. Many of the known bugs of the Bourne shell have been eliminated. MH-59554-DGK-dgk David G. Korn Copy to Members of Center 5954 Laboratory 4542 Supervision J. W. Gross N. J. Kolettis J. L. Steffen P. D. Sullivan M. T. Veach - 24 - References 1. S. R. Bourne, An Introduction to the UNIX Shell," BSTJ - Vol. 57, No. 6 part 2, pages 1947-1972. 2. W. Joy, An Introduction to the C Shell, University of California, Berkeley, 1980. 3. S. L. Arnold, Vicmd a Visual Shell for Video Terminals, TM-81-54533-12, 1981. 4. J. L. Steffen and M. T. Veach, The Edit Shell - Connecting Screen Editing with the History List, USENIX Association Toronto Proceedings, 1983. 5. M. J. Rochkind, 2dsh - An Experimental Shell for Connecting Processes With Multiple Data Streams, TM-80- 9323-3. 6. Wayne T. Wilner, See-Shell: a Graphical User-Interface for UNIX Systems, Bell Laboratories internal memorandum, 1982. 7. D. C. Smith, C. Irby, R. Kimball, and B. Verplank, Designing the Star User Interface, BYTE, April, 1982, pp. 242-282. 8. R. Pike, The Blit Programmer's manual, Bell Labs, 1982. 9. P. J. Leach, P. H. Levine, B. P. Douros, J. A. Hamilton, D. L. Nelson, and B. L. Stumfp, The Architecture of an Integrated Local Network, IEEE Journal of Selected Areas in Communications, Local Area Networks Special Issue, November 1983. 10. J. L. Steffen, An Input History for the Bourne Shell, TM-82-55426-3, 1982. 11. T. A. Dolotta and J. R. Mashey, Using the shell as a Primary Programming Tool, Proc. 2nd. Int. Conf. on Software Engineering, 1976, pages 169-176. 12. N. J. Kolettis. Extended Shell - A Potential Real Time Interpreter, TM-77-4145-01, 1977. 13. D. G. Korn and D. A. Lambeth, Form Shell, TM-80-9224-3, 1980. - 25 - 14. M. C. Sturzenbecker, A New Command Language for UNIX and related systems, TM-82-45192-3. 15. S. G. Kochan and P. H. Wood, "Unix Shell Programming," Hayden Book Company, 1985. 16. F. T. Grampp and R. H. Morris, UNIX Operating System Security, AT&T Bell Labs Tech. Journal, Vol. 63, No. 8, Part 2, pp.1649-1671, 1984. 17. D. G Korn Parlez-vous Kanji? TM-59554-860602-03, 1986. 18. G. S. Fowler, "The Fourth Generation Make," Proceedings of the Portland USENIX meeting, pp. 159-174, 1985. 19. T. H. Foregger, Shell Accounting, Case 40094-21, July 1982. AT&T Information Systems Cover Sheet for Technical Memorandum _____________________________________________________________________ The information contained herein is for the use of employees of AT&T Information Systems and is not for publication (see GEI 13.9-3) _____________________________________________________________________ Title: Introduction to KSH ( Date: June 5, 1986 Issue 3) TM: 59554-860602-04 Other Keywords: Shell Command interpreter Language UNIX Author(s) Location Extension Charging Case: 311531-0101 David G. Korn MH 5D-112 7975 Filing Case: 49059-6 ABSTRACT Ksh is a command language (shell) for the UNIX* operating system. It is essentially [1]patible with the System V version of the Bourne shell [2]has many additional features, such as those found in Csh , and executes faster than either of these shells. This memo introduces many of the additional features and explains some of the reasons for the better performance. This memo assumes that the reader is already familiar with the Bourne shell. This memo has been substantially revised since its last release because Ksh has changed significantly The Appendix contains a sample script written in Ksh. The manual page for the current version is also included. ________ * UNIX is a trademark of Bell Laboratories. _____________________________________________________________________ Pages Text: 14 Other: 24 Total: 38 No. Figures: 0 No. Tables: 0 No. Refs.: 16 _____________________________________________________________________ E-1932-U(3-76)SEE REVERSE SIDE FOR DISTRIBUTION LIST APPENDIX # # SHELL VERSION OF GREP # vflag= xflag= cflag= lflag= nflag= set -f while ((1)) # look for grep options do case "$1" in -v*) vflag=1;; -x*) xflag=1;; -c*) cflag=1;; -l*) lflag=1;; -n*) nflag=1;; -b*) print 'b option not supported';; -e*) shift;expr="$1";; -f*) shift;expr=$( < $1 );; -*) print $0: 'unknown flag';exit 2;; *) if test "$expr" = '' then expr="$1";shift fi test "$xflag" || expr="*${expr}*" break;; esac shift # next argument done noprint=$vflag$cflag$lflag # don't print if these flags set integer n=0 c=0 tc=0 nargs=$# # initialize counters for i in "$@" # go through the files do if ((nargs<=1)) then fname='' else fname="$i": fi test "$i" && exec 0< $i # open file if necessary while read -r line # read in a line do let n=n+1 case "$line" in $expr) # line matches pattern if test "$noprint" = "" then print -r "$fname${nflag:+$n:}$line" fi let c=c+1 ;; *) # not a match if test "$vflag" then print -r "$fname${nflag:+$n:}$line" fi;; esac done if test "$lflag" && ((c)) then print - $i fi let tc=tc+c n=0 c=0 done test "$cflag" && print $tc # print count if cflag is set let tc # set the exit value 0707070000020030201006660000000000020000010351300367132216500001400000024726ksh.releaseThis is a list of changes that have been made since the 02/21/85 version of ksh. A number enhancements have been made. The rest are bug fixes. Many changes of the code have been made to enhance portability with certain compile options driven by the characteristics of the target system. 1. Ksh now accepts eight bit character sets transparently. Previous versions used the eighth bit internally to keep track of quoting. 2. The expansion for "$*" now uses the first character of the IFS parameter as a separator rather than a space. If IFS is unset or null then no separator is used. "$@" now expands correctly to "$1" "$2" ..., when used as a command argument, no matter what value IFS has. "${@}" and "${array[@]}" now correctly expand to no an implicit null when {#@} and ${#array[@]} are zero. 3. The protected mode, -p has been added to 'set' and to the shell invocation line. This sets the PATH variable to the default, disables the .profile, and uses the file /etc/suid_profile instead of the ENV file. This mode is set automatically for setuid,setgid scripts. The default path has been changed to /bin:/usr/bin:. A restricted shell now disables setting the ENV parameter. 4. The shell can now execute scripts which do not have read permission and scripts which have the setuid and/or setgid set when they are invoked by name rather than as an argument to the shell. For this feature to work, a program supplied with ksh named suid_exec must be installed as a suid root program in /etc and ksh must be installed in the /bin directory. 5. The history file has a slightly changed format. Old style ksh history files are recognized and read correctly. It allows eight bit characters in commands and supports essentially unlimited size histories. 6. The HISTSIZE parameter now controls how many commands from the last login session are saved. Previously, the last 4K bytes of the history file was saved across logins but since the history file stores the text of functions, the number of saved commands varied. 7. The shell now accepts decimal values as numerical constants when performing arithmetic evaluation and truncated them. Thus let x=2.2 yields x=2 rather than producing an error message. 8. Options settings, set, are now atomic, i.e., they all take effect or none take effect. Previously, set -emacs caused the shell to abort since -e set the error on exit, and the c option cause the set command to terminate with an error. Now this will just produce an error. 9. The commands echo and pwd are built into ksh. Previously, they were aliases. On BSD Unix echo will behave like "print -R" if echo would "whence" to /bin/echo if it were not a built-in. The PWD variable is no longer readonly but will be reset by cd. 10. The -a option has been added to ulimit for BSD. This option can be used to list all current resource limits. 11. Process substitution, the ability to pass named pipes as command arguments, has been documented even though it still does not work on all UNIX systems since it requires the /dev/fd directory. 12. The shell now uses the LINES parameter to control printing of select lists. When possible, select tries to use about two-thirds of the number of LINES. kill -l now uses select list format with numbers representing the signal number. 13. There have been a number of additions and changes to the emacs edit mode. The command M-C has been change to M-c and the command M-l has been added to convert to lower case. Several of the M- commands not allow numeric parameters. M-= has been added to list the files matching the current word. In the BSD version, the character ^Y can now be used as an editing character. 14. Errors on some built-ins now cause a shell script which contains them to abort. The details as to which ones are in the manual page. 15. A shell variable SECONDS has been added which is incremented every second. Initially it is set to zero but you can assign to it to reset it. It is an integer variable. 16. The shell now prints the line number on error messages. This should aid debugging scripts. 17. The execution trace flag, -x, is no longer remains on when executing shell functions. Instead, any function which has the -t attribute turned on (typeset -ft ), will cause the trace flag to be turned on for the function . 18. You can now do expansions for multi-digit positional parameters. However, you must include the number in braces. Thus, ${11} gives the eleventh positional parameter and eval '$'{$#} gives the last. 19. The code has been reorganized somewhat and generates far fewer lint warnings. There is more automatic feature configuration and there is a 4th generation makefile included for those who have fourth generation make available. A VFORK compile option is available which causes the shell to use vfork() instead of fork() whenever possible. This is now the default mode for apollo UNIX. The shell no longer uses the segmentation violation faults internally so there should be fewer "no space" messages. 20. The y and Y commands have been added to the vi-edit mode. A new command = has been added which prints a select list of files matching the current word. The @ command has been added to allow macro definitions. Some modifications have been made to speed up screen updates at slower baud rates. 21. When the shell is invoked as sh prog a path search is now performed on prog. 22. There is a new command substitution syntax $(command). The old `` syntax is still supported and is completely compatible with the SVR2 shell. The new syntax allows anything within () without quoting since this quoting nests. Thus, "$(" $()")" is legal and performs a nested command substitution. Any old script which has a $( within "" must prepend a \ in front of the $ to make it work for ksh. The script will continue to run under the SVR2 shell. 23. The variable _ is set to the file name of the command exec'd in the environment. Thus, any program can find its binary file whenever it is invoked by the shell. 24. Bugs fixed in all versions. a. An insidious bug which, on rare occasions, caused cd to fail without any indication has been fixed. This bug only occurred with certain environments. Its only reports happened in conjunction with a recursive make procedure. b. A shell invoked as sh -c 'program <&1 cmd >file is now equivalent to cmd 2>&1 >file. In the Bourne shell and in earlier versions of ksh, the order of redirection was reversed in the first form. bb. Open file descriptors for units above two no longer get closed on exec for compound commands. Thus, the command { command1;command2;} 7> file will no leave unit 7 open for command1 and command2. cc. A bug in printing the ulimit on 16-bit machines has been fixed. dd. The command substitution `< file*` now expands when there is exactly one matching file. ee. The shell now checks for running out of open file descriptors internally and prints out a message. ff. The ulimit -p now gives the correct error on systems that don't support this option. gg. Unsetting the highest element of an array, no longer causes ${array[*]} from producing a bad subscript error. 0707070000020030251007550000000000020000010351440366167647200001600000001213ksh.substring# substring function # this function should be equivalent to the substring built-in which was # eliminated after the 06/29/84 version function substring { typeset lpat flag str #local variables set -o noglob #no file name generation case $1 in -l|-L) flag=$1 lpat=$2 shift 2 ;; esac # test for too few or too many arguments if [ x"$1" = x -o $# -gt 2 ] then print -u2 'substring: bad argument count' return 1 fi str=$1 if [ x"$flag" = x-l ] #substring -l lpat then str=${str#$lpat} elif [ x"$flag" = x-L ] then str=${str##$lpat} #substring -L lpat fi if [ x"$2" != x ] then echo ${str%$2} else echo $str fi return 0 } 0707070000020030271007550000000000020000010351450367134550100001400000001566ksh.getopts# for compatibility with the S5R3 /bin/sh getopts builtin function _getopts # [ arg ] ... optstring name { OPTIND=${OPTIND:-1} integer n=$#-1 eval typeset opstring=['$'$n] name='$'{$#} balance typeset -L1 c d shift OPTIND-1 if test X"$_arg" = X then if (($# > 0)) then _arg=$1 shift else return 1 fi fi case $_arg in --) _arg= return 1 ;; -*) c=${_arg#-} case $c in $opstring) d=${opstring#*$c} balance=${_arg#*$c} if test X"$balance" = X then if test X$d = X: then OPTARG=$1 let OPTIND=OPTIND+2 else let OPTIND=OPTIND+1 fi _arg= else if test X$d = X: then OPTARG=$balance _arg= let OPTIND=OPTIND+1 else _arg=-$balance fi fi eval $name=$c return 0 ;; *) echo $0: bad option eval $name=? return 1 ;; esac ;; *) _arg= return 1 ;; esac } alias getopts='_getopts "$@"' 0707070000020030301047550000000000020000010351460367133042100001200000036004suid_execR 0  .text0 .data 8@.bss    OQ./HJf/H# N,/N0d0<N@NVH#  n # N# Nt#  N~# $Nj# ( n $P. 0N. 0/ N"XJfnp .N.` Jl . $N..Hn/.N0HP.Hn/.N/@P$f.N.<.N.N@dN0ZNu0<*N@dN0Z o BNuNVHA -H. //.N P$9 g pLN^Nu `0<.N@dN0ZBNu0<N@dN0ZBNuNVJfpN^Nup.N H-@. .p/N#X @-HBBJgB .c .R`* .-@-nBS.p/N#X. JN bJf.N HN Pp.N H-@Jm.p/N#XJn JlJg .Ю.N H .Ю`NVp./< JN rXN^Nu0<N@Nu0<N@dN0ZBNu o HBNu o /fpL.NuNVH<$n&nBB.G(J`RHH$gp%f -@"gtѮ "f&Sm kR`P.p/N'PX`> + f."/ /+N"XP @"'H`./."p// N j Jf+ f .L<N^Nup-@-@-@-@-@RHH$  g$ #g" +g -fR`R`R`R`p*f$pѮ n -hl .D-@RR`Bp0fRB` .Ѐ"Ё"0Ё-@RHH$ | 0(f .gJg .`p-@`VR *fpѮ n -hR`8B` .Ѐ"Ё"0Ё-@RHH$ | 0(fBHH hg lfRR-| LAG-HHp-@-@HH$ Jgv Eg Gg XgT cg dgL eg fg gg og* sg ug xfp` p`p`p-@Jlp-@JfpdpѮ n -h>pdfBJ>l-| L >g* .>D-@>`Jg -| L`Jg-| LpXf | ` | -H*I\*L`Dp>-@ .>-@>.N.ЀЮ"n*1. .>N!-@>J>f Ю-@Jgȹg  Xg4 og xf-| L` lp-@`-| L`xJlp-@pѮ n -h6-h:Hn.Hn2 .Rrl .R`p//.:/.6N @(HJ.g -| L`Jg -| L`Jg-| LKQJgHH`p0JfJg.-n`SJoJfIQ. /9 .6".:NXJg .2S-@"JlD`Jlp-@pѮ n -h6-h:Hn.Hn2 + f."/ /+N"XP @"'H`./."p// N j SmVSm kRr0`.p0/N'PX` kR"nHRH`. nHRHp/N'PX nHJg$Sm` kRr `.p /N'PXS .䰮&mSm`J"g@p . ."N.0rH"nHp . ."N!-@"`pH nH0 nHCEbJ2n . /9 .6".:NXJfp+`p-rH"nH | 0(gpE`perH"nH`>NVp././././. /.N> @ N^NuNVp././././. /.N @ N^NuNVH<$n&| ~ ."KI . fp.N+J/N!X. /9 .". NXJlp`p"n"g .". @-@-A B9 ~B. /9 .". NXJgd*| R. :/9 6 .". NXJm,`>./ .". NX-@-A -ђ`. B/9 > .". NXJm`-y F-y J` -n-n./. 9 N"9 RNX-@-A. /.".NXJo`. j/9 f .". NXJln`8./ .". NX-@-A -` M o2./ .". NX. r/9 nNXJl`Jgҹ ~eй c(| . z/9 v .". NXJg e0`T .". Nb$ 0 N&./ .". NX./ 9 ~"9 NX-@-A e$&L 5m0 ~f1 ~RJgR`R`R0R# 9nB | ~ L<N^Nu M o./ .". NXJm`./. .". NXNb$ 0 N&./.NX./ .". NX-@-A R. Z/9 V .".NXJo^. b/9 ^ .".NX-@-A`ZH?L ` H?LN "LNuH? o "($/ &/$N " LNuH? o/NDX$/ &/$N//NvP LNuH?$& /"/ `H?$/&/ /$"/(Nj "LNuH? o$&( / "/$NF " LNuH? o/NDX$& / "/$N//NvP LNu@UUŰcBCEHNJJGf(g~JFf `0 FgrFDGQGmfJf` ^GkQJkցՀd RF Fm`LdFED@NzNM fBNuN`(fFfJj$<B`$<B`H?$& /"/ `H?$/&/ /$"/(Nj "LNuH? o$&( / "/$NF " LNuH? o/NDX$& / "/$N//NvP LNu*BNb:G8<a,8<aᏄg$&<FN`.HGODfJfJgRGSGgNu8<@ANBCFgDgNg Dg,NuNJk&Fg"Jg `Jk6g2$<`N LNu"`"/H8NVN0 LNu$<&HCĀ(f<Jg,<`&HBJ Bf4<`<Jg<`SB<B2Nu m `B>BFCNBNr, AKNux ,<.̂(ȃ⊄(΀ȁ∀NuJf F m F BJgk [ZNu<