else ... if ... then ... else if ... ... fi fi fi : if ... then ... elif ... then ... elif ... ... fi if 1 then 2 fi : 1 && 2 1 || 2 2 , 1 - 23 - . . 3.8. tel, , grep /usr/lib/pfone. - .  . : for i do grep $i <&lt;<&lt;! ... .. 224 01 01 .. 123 07 07 .. 224 44 94 ... ! done , <&lt;<&lt;! !, grep . - ! : , , <&lt;<&lt;. <&lt;<&lt; \,   e, - . , edg : ed $3 <&lt;<&lt; % g/$1/s//$2/g w % : edg 1 2 file , - : ed file <&lt;<&lt; % g/1/s//2/g w % - 24 - 3.9. SHELL . : set -v . . - , : sh -v proc... proc - . -v - -n, - ( set -n , EOF). set - . -x -v set - - - -. 4. , , . - , , : - ; -  ; - - . , : USER=nata   USER - 25 - nata. -k - = .  - . "1", "2", ... N ( - , ). - set. , set * "1" , "2" - .. - : - , : $user - , : `pwd` , - , - eval. , - X $y, y - pqr, eval echo $X pqr. eval SHELL, . , wg='eval who | grep' $wg fred who | grep fred - 26 - eval , | . - -. , , , - .  , . IFS; , .  - , . , a echo '' , echo, echo $null , - null . - . *, ? [...] ( ) , . . , for, . case , - case. , SHELL ( \, '...' "..."). , , - . , - : - 27 - $ ; ` ; ; \ $, `, " \. , echo $ x . , echo $* - ; : echo $1 $2 ... $@ $* , . echo $@ echo $1 $2 ... . . 1 - SHELL. $ * ` " ' -|------------------| ' | - - - - - t | ` | + - - t - - | " | + + - + t - | _|__________________| + ; - ; t . .1 - 28 - 4.1. , . - , , - : , ( ). , : export USER BOX , USER BOX. - . . . ( - ). , , readonly ( - ). export: readonly ... - . 4.2. SHELL , . echo ${d-.} d, , '.' - . echo - . , d , echo ${d-'*'} *. , echo ${d-$X} d , , - X. - : - 29 - echo ${d=.} d , - '.' ( ${...=...} ). echo ${d?} d, ,  - . - .  - , . , - , : : ${USER?} ${HOME?} ${BIN?} ... : SHELL, . USER, HOME BIN , . 4.3. SHELL . , - pwd - , , , /usr/nata/bin, d=`pwd` d=/usr/nata/bin , `...`, - . , , "`" \. , ls `echo $1` ls $1 - 30 - , , ( ). - . SHELL , - . basename, - . , basename main.c .c main. - basename - cc: case $A in ... *.c) B=`basename $A .c` ... esac B - A, .c. 4.4. : - . , / -i. , : - / (, ); - , ; - , . , , , . : - (while, until, if, for); - 31 - - . , -e. 4.5. , , .1. , . - , ( - ) , . - , , , . 1 ------------------------------------------------------------ ------------------------------------------------------------ 0 ( , ) 1  2 3* (CTRL/Q core, ) 4* ( ) 5* BPT ( ) 6* / IOT 7* EMT 8* 9 ( - ) 10* 11* 12* 13 - 14 15 ( kill) 16 ------------------------------------------------------------ , *, . , - . - 32 - - , . , . SHELL trap. , trap 'rm /tmp/ps$$; exit' 2 2 () rm /tmp/ps$$; exit exit . : 1. ( ). 2. ( ). 3. . . , trap. trap , . - nohup: trap '' 1 2 3 15 , . - , , : trap 2 3 trap trap ( - ) - 33 - scan, - , , _ .  . scan : d=`pwd` for i in * do if test -d $d/$i then cd $d/$i while echo $i: trap exit 2 read x do trap : 2; eval $x; done fi done read x - - x. _  , . 5. ( login) SHELL. .pro- file, , (, .profile ). : -c  . -s . - . -i . "0" -, .profile. 6. SHELL - 34 - 2 ------------------------------------------------------------ ------------------------------------------------------------ # ; | ; ~ ; ; ; & , - ; && , - ; || , - ; '...' ; "..." , ; \ - . ------------------------------------------------------------ 3 - ------------------------------------------------------------ ------------------------------------------------------------ [d]<&lt; , - d ( d=0); [d]>&gt; , - d ( d=1); [d]>&gt;>&gt; >&gt;, , ; [d]<&lt;<&lt; , - , ; [d]<&lt;& ; [d]>&gt;& - ; [d]<&lt;&- ; [d]<&lt;>&gt; (). ------------------------------------------------------------ - 35 - 4 ------------------------------------------------------------ ------------------------------------------------------------ ? ; * ( .. ); [...] ; , -, - ; ------------------------------------------------------------ 5 ------------------------------------------------------------ ------------------------------------------------------------ $n $n n; $* "1 2 ..." $@ "1" "2" ... $# ; $- , set; $? ; $$ ; $! ; = ; ${-}  , , - ; ${=} ; - - ; ${?} , , -  - ; ${+} ,  , - ; $HOME cd ; $PATH ; $MAIL ; $PS1 ( $); $PS2 ( >&gt;); $IFS  ( - , ); ------------------------------------------------------------ - 36 - 5 ------------------------------------------------------------ ------------------------------------------------------------ $TERM . ------------------------------------------------------------ - 37 - for  [in ...] do _ done case  in [1 [|2]...) _;;] ... esac if _ then _ [elif _ then _] [else _] fi while _ [do _] done until _ [do _] done (_) { _; } break [n] for, case, while until n; continue for, while until; exit [N] N; : , - . - 38 - .   ; eval [ ...] " ..."; exec [ ...]  ...; export [ ...]  ; read  ... ; readonly [ ...] ; set [-ekntuvx [ ...]] ( - . sh); shift ; 1=2 ...; times , ; trap [] [n] , n; umask [nnn] - ( ); wait [pid] pid. - 39 - ......................................... 2 1. .......................................... 3 2. .................................. 3 2.1. ................................. 4 2.2. ................................ 4 2.3. ............................. 4 2.4. ....... 6 2.5. / ..................... 6 2.6. , ............ 8 2.7. ................................. 9 2.8. ................................ 12 2.9. ............................... 12 2.10. .............................. 12 3. ................................... 15 3.1. ..................................... 17 3.2. test .................................... 17 3.3. for .................................... 18 3.4. case ................................... 19 3.5. while until ......................... 21 3.6. break continue ...................... 22 3.7. if ..................................... 22 3.8. .................................. 24 3.9. ........................ 25 4. ...... 25 4.1. ............................. 29 4.2. ................. 29 4.3. ....... 30 4.4. ................................ 31 4.5. ............................ 32 5. .............................. 34 6. SHELL ........... 34 - 40 -