:


     Shell -  ,        ,
  ,   ,   .


                              ""

                

1.    shell . . . . . . . . . . . . . .
1_1. - . . . . . . . . . . . . . . . . . . . . . .
1_2.      . . . . . .
1_3.  . . . . . . . . . . . . . . . . . . . . . . .
1_4. ,    . . . . . . . . . .

2_   shell  . . . . . . . . . . . . . . . . .
2_1.   . . . . . . . . . . . . . . . . . . . . .
2_2.      . . . . . .
2_3.      . . . . . . . . .
2_4.   . . . . . . . . . . . . . . . .

3_    . . . . . . . . . . . . . . . .
3_1.   . . . . . . . . . . . . . . . . . . . . . . .
3_2.    . . . . . . . . . . . . . . . . . . .
3_3.    . . . . . . . . . . . . . . . . . .
3_4.    . . . . . . . . . . . . . . . . . . . . . .
3_5.   . . . . . . . . . . . . . . . . . . . . . . .
3_6.    . . . . . . . . . . . . . . .
3_7.    . . . . . . . . . . . . . . . . .

4_  shell-  . . . . . . . . . . . . . . .
4_1.  shell  . . . . . . . . . . . . . . . . . . . .
4_2.  . . . . . . . . . . . . . . . . . . . . . .
4_3.   . . . . . . . . . . . . . . . . . . . . . .
4_4.   . . . . . . . . . . . . . . . . . . . . . . .
4_5.   . . . . . . . . . . . . . . . . . . . . . .

5_    . . . . . . . . . . . . . . . .
5_1.  test . . . . . . . . . . . . . . . . . . . . .
5_2.  expr . . . . . . . . . . . . . . . . . . . . .
5_3.  ena  . . . . . . . . . . . . . . . . . . . . .





       -   -  -
 ,        .  
,         
    .
      ,        .


        < < >

     ( 
0),

        > < >

   (  1);

        << <>

    ,     -
 <>   ,

        >> < >

  ;   ,   -
     ,

        <& <>

     , 
  <>;    

        >& <>

        <&-  >&-

     .
            ,    
    ,   -
 ,  0  1  . ,

        2 > < >

     2, 

        2 >& 1

  2  ,   -
 1.

            ...  2>protocol
      (  2)   
 protocol.

     ,   -
  ,   
            ...  2>&1

       : shell    -
     . ,

        1 > xxx 2 >& 1

   1   xxx,   -
 2  1, ..   xxx. 

        2 >& 1 1 > xxx

  2  ,  1 -   xxx.

              :

isql - - <

1_2.

shell . , .. . ( -) &. - /dev/null. : primer echo > primer : prog , - , - , prog.res, - prog.tim. time prog > prog.res 2> prog.tim & - , |. ; shell . & - . ; . , - . - - . ls *.o | wc -l - , : ? * ; & ( ) | ^ < > <> <> <_> , \. , - ' ', . (") ( . 2.2) (. . 2.3), \, `," $ \. - *,?, [. , , ( ). , . : * , ? [...] . , -, , , . "[" "!", , #, . (`). . , , . . .for. - .err. name=`ena -n $1` rm -f ${name}.err , ena -n $1 name. . .err . shell - . , (_). , $. - . : . - , : $0 - , $1 - .. - set (. ). . shell, ficofl: ficofl -d / \*.for $0 ficofl, $1 - -d, $2 - /, $3 - *.for, - . , * ficofl - , - . : $@ $1 $2 ..., $* - "$1 $2 ...". - : <>=<> [ <>=<> ] ... (. - ) . - : ${<>} <> , . <> , . ${<>:-<>} <> , ; <>. ${<>:=<>} <> , <>; . ${<>:?<>} <> , ; <> shell . <> , "parameter null or not set". ${<>:+<>} <> , <>; . : d - , pwd echo ${d:-`pwd`} shell: # () - , shell - set ? , $ ! @ $1 $2 $3 ... * "$1 $2 $3 ..." : , $. : : echo $$ Shell : HOME , cd PATH , . PS1 ( $) PS2 ( >); shell . new_line, , IFS , - ( <>, <> <_>) - , . , , . 0 (.. $0). , - , , () 200+, . - - , ;, &, && || - ; &. ; & , , && ||. . ; , - , & - . && (||) , , , (). - , - . - . for <> [ in <> ] do <> done in <> , in "$@" ( in $1 $2 ... $n). . : for f in *.for do cat $f done case $<> in <> | <>... ) <> ;; . . . esac <>, <>, <>. , . | ... . . . # flag= # for a do case $a in # , -[ocSO]) flag=$flag' ' $a ;; -*) echo 'unknown flag $a' ;; # *.c) cc $flag $a; flag= ;; *.s) as $flag $a; flag= ;; *.f) f77 $flag $a; flag= ;; # *) echo 'unexpected argument $a' ;; esac done if <1> then <2> [ elif <3> then <4> ] . . . [ else <5> ] fi <1> , 0, - <2>, - <3> , 0, <4>. , <5>. elif else . while <1> do <2> done , <1> 0, <2>. while until . <1> true (false). , 0 (-1). - . break (. - ). <> () { <>; } <>. - <>, { }. : if then else elif fi case in esac for while until do done { } , shell . , shell . : . - . . file Shell file, ; file $PATH. break [n] for while ; n, n . continue [n] for while ; n, n- . cd [ <> ] <- >. HOME. echo [ <> ... ] , . eval [ <> ... ] , - , . exec [ <> ... ] shell , . - , , - - - . exit [ n ] shell n. n , ( - ). export [ <> ... ] - (. ) - . , - . . hash [ -r ] [ <> ... ] . -r . , : hits - shell ; cost - - ; command - . , - * hits. pwd . read [ <> ... ] ; - , - .., - - . readonly [ <> ... ] - . , readonly. return [ n ] n. n , - . set [ --aefkntuvx [ <> ... ] ] : -a , , (. - ) -e , - shell -f -k , , (. ) -n , -t shell - -u -v -x - -- , - . + - - . $-. <> - , $1, $2 .. , . shift [ n ] , $(n+1), - $1 .. n=1. test (. - . Test ) trap [ <> ] [ n ] ... <> , shell - n (. ). ( , <> ). . - , , . - 11 (segmentation violation) - . <> , - . <> , shell . n=0, <> shell. Trap , . type [ <> ... ] , - : shell, . ulimit [ -f ] [ n ] n ; -f - - , - ( ). - - . umask [ nnn ] - nnn. nnn , - . : umask 755 , - , , - . unset [ <> ... ] - . PATH, PS1, PS2 IFS . wait [ n ] . n , - -- 0. , shell-, /bin/sh. shell-, - . , shell-, - (x), . , ( ficofl shell-): sh ficofl -d . g\* ficofl -d . g\* shell- . , . . - , , . PATH , - . ::/bin:/usr/ bin:/util:/dss/rk ; :: . /, $PATH : , / , - - . shell hash. - -, . Shell - . shell , . - , , export shell (. set -a). - unset (.). , shell -, - shell, , unset, , export. . , TERM=d460 <> (export TERM; TERM=d460; <>) . , , . -k (. set), - , . UNIX : SIGHUP - 1 - (hangup) SIGINT - 2 - (interrupt) SIGQUIT - 3 - (quit) SIGILL - 4 - (illegal instruction) SIGTRAP - 5 - (trace trap) SIGFPE - 8 - (floating-point exception) SIGKILL - 9 - (kill) SIGBUS - 10 - (bus error) SIGSEGV - 11 - (segmentation violation) SIGSYS - 12 - (bad argument to sys- tem call) SIGPIPE - 13 - (write on a pipe with no one to read it) SIGALRM - 14 - (alarm clock) SIGTERM - 15 - (software ter- mination signal) SIGINT SIGQUIT , . , -, SIGSEGV (. - . Trap). . , , ( ). - hash -r (. - ). , pwd . - cd - . test . - : test <> [ <> ] test <> , - - , 0 (true); - - (false). . <> - : -r - , -w - , -x - , - -f - , - -d - , - -c - , - - -b - , - - -p - , - (pipe) -s - , - -t [ ] - , - ( 1) - -zho s1 - , s1 -n s1 - , s1 s1 = s2 - , s1 s2 s1 != s2 - , s1 s2 s1 - , s1 n1 -eq n2 - , n1 n2 - . -eq -ne, -gt, -ge, -lt, -le expr . - . . . , 0 , . , , . 32- . , . , , - \. <> \| <> <> , , <> <> \& <> <> , <>, 0 <> { =, \>, \>=, \<, \<=, != } <> <> - ; - <> { +, - } <> <> { \*, /, % } <> , - <> : <> : , - . , - (0 ). - \( \) . : . - * - , [] - - ; "-" (.. [0-9] [0123456789]); - [ ^, - , <_>; ] , [ (.. []...]); . * ( ^, ) . ., *,[ ] (.. \., \*, \[, \]). . 1. a=`expr $a + 1` - 1 a 2. expr $a : '.*/\(.*\)' \| $a - (.. /usr/util/ena ena). , / . 3. expr $VAR : '.*' - VAR. expr - : 0 - 1 - 2 - expr : syntax error - non-numeric argument - . , a - , expr , , . $a - . shel- l, expr $a = '=' expr = = = . - : expr X$a = X= .. , , . ena . - , - . : -n - -f - -e - -d - -p - . .. , ena, /util/ena. # Get part of pathname case $1 in -n ) expr $2 : '.*/\(.*\)[.].*' \| $2 : '\(.*\)[.].*' \| $2 ;; -f ) expr $2 : '.*/\(.*\)' \| $2 ;; -e ) expr $2 : '.*\([.][^./]*\)' \| ' ' ;; -d ) expr $2 : '\(.*\)/.*' \| $2 ;; -p ) expr $2 : '\([.]\)/.*' \| $2 : '\([.][.]\)/.*' \| ' ' ;; * ) echo "error: unknown part of pathname $1" exit 2 ;; esac

Last-modified: Sun, 07 Jul 2002 09:31:58 GMT
: