,
, , ,
.
- 44 -
, -
-
.
.
history :
1 cat file1
2 pr -w39 -l24 -2 file1
3 cc program.c >>& errors &
4 cat errors
5 ed program.c
6 history
, ,
:
!2
;
!!
:
!-2
( );
!cat !c
. -
, -
(cat c),
;
!{cat}.a1
cat errors.a1 -
.a1;
!?gram?
. -
, -
gram. ? ,
;
cat !5* !1*
cat program.c file1 - -
,
.
.
, 0. 0 -
. ,
,
- 45 -
cat !3:1
1,
cat program.c
:
* n* n-m
, 1,
, n,
, n -
m;
n n-, -n
n, , -
n, ,
, 0
n;
??:%
, ;
^ $
1 .
:
^ $ * - %
. history
:
1 cat file1 file2 file3
2 pr -w39 -l24 -2 file1 file5
3 cc -o program1.c program2.c >>& errors &
4 cat errors
5 ed program2.c
6 history
csh , -
:
!5:0 !1:3
0 (
),
3. ed file3;
- 46 -
!5:0 !1$
0,
- . ed file3;
!2:-3 !3:2-3
2 0 3 -
, 3 2
3. :
pr -w39 -l24 -2 program1.c program2.c
!2-3 !?prog?%
:
pr -w39 -l24 -2 program2.c
, -
,
.
.
:
p
, ;
&
;
s/_1/_2/
_1 _2. / -
, . -
_2 , _1 .
-
. ,
. history
:
1 cat /usarc/gruppa/ivanov/file1.c
2 pr /usarc/gruppa/ivanov/file1.c
3 cc pa1.c pa2.c pa3.c pa4.c >>& errors &
4 cat errors
5 ed program.c
6 history
, -
, :
- 47 -
!1:0 !1^:t:r
1 0, ..
, cat.
1,
/usarc/gruppa/ivanov/file1.c. t
,
/usarc/gruppa/ivanov,
file1.c. r .
, cat file1.
!1:0 !1^:h/document
^
, h ,
, ,
cat /usarc/gruppa/ivanov/document
!1:0 !1^:h:s?ivanov?sidorov?/document
-
, , s
ivanov sidorov
cat /usarc/gruppa/sidorov/document
!1:0 !1^:h:s?ivanov?sidorov?/doc !1^:&:p
. 1
1,
( & ), , ..
?ivanov?sidorov?,
. ,
( p):
cat /usarc/gruppa/sidorov/doc \
/usarc/gruppa/sidorov/file1.c
!1:0 !3:1-4:gs?pa?ff?:p
, 3
1 4 -
( g)
?pa?ff? . , -
( p):
cat ff1.c ff2.c ff3.c ff4.c
-
. -
^^^. ,
cat aaa bbb ccc ddd, ^ccc^file.c^
- 48 -
: cat aaa file.c ccc ddd.
. -
. -
, , -
, . , -
alias sp "sort \!* | print"
sort file1 file2 | print
sp file1 file2
. !* -
sort, -
sp.
,
,
alias unalias.
, ,
, , -
, . ,
. -
! . -
. csh,
alias a alias
alias.
1.12. csh
csh :
.
,
, .
(
) . , argv
, ver-
bose
.
. .
-
- 49 -
.
.
-
- -
. ,
.
: argv, cdpath, cwd, home, path, prompt,
shell. child status
. set
csh. -
unset. -
.
argv
. -
.
cdpath
,
. ,
cdpath : set cdpath = (
/usr/include /usr/lib ), chdir sys -
chdir /usr/include/sys.
checktime
-
- ,
exit. , set
checktime = 3, , 3 -
- , exit, -
.
child
.
. child -
, .
cwd
-
. -
, symlink.
echo
.
. echo
,
. ,
csh -x comfile echo
comfile, set echo -
.
- 50 -
history
-
, .
. - 22 .
home
. -
csh HOME.
ignoreeof
-
.
/D CTRL/D .
stty(1).
mail
, .
noclobber
.
noglob
.
nonomatch
, (, echo *.[2-
5]) , -
. nonomatch,
, -
.
notify
. notify ,
.
path
,
, .
-
, path.
.
, .. -
, ,
-,
.
rehash. rehash
-,
.
~/.cshrc -.
,
- 51 -
, -
-f
csh -f comfile
- ,
set -
path.
prompt
,
. -
,
. prompt -
, % -
# .
shell
,
. -
SHELL
.
status
, :
% false ; echo $status
1
% true ; echo $status
0
false 1 -
, true 0 -
.
time
. -
,
. ,
~/.cshrc set time = 6, ,
-
, -
6 . , , sort
file,
:
1.6u 17.9s 0:26 74%
: 1.6u - ;
17.9s - ; 0:26 - -
; 74% -
-
.
- 52 -
verbose
. ,
-v -
.
-
.
:
csh -_ _ ...
_ , -
.
:
-c ,
-c;
-e ,
( 0);
-f ~/.cshrc
;
-i .
,
;
-n ,
. ;
-s ;
-t .
\;
-v
;
-V ~/.cshrc ~/.login
-v.
,
-
;
-x -
;
-X -x ~/.cshrc
~./login.
- 53 -
- ,
.
,
. -
set unset.
, -
.
.
setenv, - unsetenv. -
,
setenv.
.
,
. -
. -
. , -
.
:
PATH
, ;
HOME
,
/etc/passwd;
TERM
;
TERMCAP
/etc/termcap;
SHELL
, -
;
MSG
,
(MSG = r - -
, MSG = l - );
USER
.
unsetenv
. setenv
- 54 -
% setenv NAME 15
% echo $NAME
15
% @ a = ( $NAME + 15 )
% echo $a
30
% setenv NAME "Jan Feb Mar Apr"
% echo $NAME
Jan Feb Mar Apr
-
, .
1.13.
: ~/.hushlogin, ~/.login,
~/.cshrc, ~/.logout ~/.history.
~/.hushlogin .
,
/etc/motd - -
. /etc/motd
, "" ..
~/.login ~/.cshrc, -
~/.logout.
~/.cshrc, ~/.login. -
~/.history, .
, ~/.history,
, -
.
~/.login , -
.
:
set ignoreeof
set prompt = ' .._\!> '
if( $?MAIL ) set mail = $MAIL
msgs
setenv MSG r
ignoreeof,
/D (CTRL/D).
- 55 -
,
. \!
history, :
.._15>
.
, :
" ".
mail, .
msgs,
( , -
).
MSG,
( - ,
l).
~/.logout
.
.
~/.logout ,
. , , -
, , -
, .
csh ~/.cshrc.
~/.cshrc:
set path = ( . /bin /usr/bin /usr/ucb )
set history = 22
set savehist = 22
set checktime = 3
set prompt = ' .._\!> '
alias h history
alias c /bin/cat
alias l /bin/ls -l
set path = (. /bin /usr/bin /usr/ucb)
, csh
.
set history = 22
,
.
set savehist = 22
,
- 56 -
~/.history.
.
set checktime = 3
(3 ), csh
"". -
- ,
exit csh .
,
.
set prompt = ' .._\!>'
, csh
. -
,
.
-
. , ~/.login -
- ;
~/.cshrc .
1.14.
,
.
alias
alias
alias _
alias
. -
, alias,
.
, -
, , -
. -
.
alloc
,
,
.
.
bg
bg %__
bg %__
- 57 -
-
.
break
end
foreach while. -
-
break , ;.
breaksw
switch
endsw;
case :
- switch.
-
( *, ?, [...] ). .
cd
cd
chdir
chdir
.
,
.
continue
while
foreach. end , -
.
default:
switch.
, case, -
, default.
default case. -
.
dirs
.
pushd,
popd.
1,
.
echo _
echo -n _
. -n
.
- 58 -
else
end
endif
endsw
. foreach, if, switch
while.
eval ...
, eval
,
, .
exec
.
.
exit
exit()
( )
( ). -
status .
fg
fg %__
fg %__
( )
.
foreach (_)
...
end
-
end (foreach end
).
glob _
echo.
.
, -
.
- 59 -
goto
.
, .
:.
goto , ,
.
.
hashstat
, , -
-
. .
history
history -r
history n
history -r n
history -h
. -r -
. n,
n . -h -
~/.history.
if()
( ),
. . -
/ .
, .
if(_1) then
...
else if(_2) then
...
else
...
endif
_1 ,
else. , _2
, else ..
else-if; endif
. else .
else endif ,
. if
else.
jobs
jobs -l
- 60 -
. jobs -l
.
.
ps jobs -l, - jobs.
,
. -
. + -
; - -
.
kill %__ ...
kill -SIG %__ ...
kill %__ ...
kill -SIG %__ ...
kill __ ...
kill -SIG __ ...
kill -l
SIG , TERM
(). SIG ,
SIG (
/usr/include/signal.h). kill -l
.
limit _ _
limit _
limit
32- -
, .
,
, ,
. ,
;
_ ,
.
cputime (
, ),
filesize (
, ),
datasize ( _+_
sbrk(2) ),
stacksize ( -
), coredumpsize
( , ).
( ),
- 61 -
.
.
login
login
login .
login
.
.
logout
. ~/.logout, ,
.
.
nice
nice +
nice -
nice
nice +
nice -
.
: [-100; +100], +100
.
, 4, - ,
, - , -
4.
.
,
.
, .
nohup
nohup
SIGINT (CTRL/C), SIGQUIT
(CTRL/\) SIGHUP (BREAK - -
).
, . ,
-
. nohup -
.
- 62 -
notify %__
notify %__
notify
-
. -
. notify ,
.
onintr
onintr -
onintr
. -
,
.
.
-
- . ,
csh , onintr -
.
popd
popd +
cd __2 .
__1 , -
.
popd + __(1+)
,
. -
.
pushd
pushd _
pushd +
pushd
. pushd cd
__2 . __2
, __1 - ; -
.
pushd _ cd _