"Csh"의 두 판 사이의 차이
둘러보기로 가기
검색하러 가기
잔글 (→참고 문헌) |
(차이 없음)
|
2011년 1월 19일 (수) 16:04 기준 최신판
UNIX C Shell(csh)에 대한 일반적인 정보를 저장한다.
목차
C Shell 기본
- Last update : 1998.03.05 - 1998.12.14
- 자료 입력
set VAR = $<
- cut -d[경계기호] -f1,3-4 file
- awk 'BEGIN {~} {~} END {~}' file
awk -F[분리기호] -f File file NR : 레코드 번호
- 환경변수가 있는지 검사
if ($?GROUP == 0) then set GROUP="init" setenv GROUP "init" endif
C Shell의 유용한 특징
Filename Completion : ESC, ^D, ~[user] Command Aliasing : alias lm 'ls -l \!* | more' History Substitution : !!, !n, !-n, !?str? additional, !{command} additional, ^prev^replace^, !:s/prev/replace/, !6:s/prev/replace/ Job Control : CTRL-z, bg, fg, kill, stop, % = %+ = %%, %-, %j, %?string I/O Redirection : <, <<word, >, >!, >&, >&!, >>, >>&, >>!, >>&! Variable Substitution : $var = ${var} $var, $var[index-index], $#name, $0, $n = $argv[n], $* = $argv[*], $?var, $?0, $$, $<, $#argv, $status Filename Substitutions : *, ?, [ ... ], { str, str, ... }, ~[user] Expressions and Operators : (...), ~, !, *, /, %, +, -, <<, >>, <, >, <=, >=, ==, !=, =~, !~, &, ^, |, &&, ||, -r filename, -w filename, -x filename, -e filename, -o filename, -z filename, -f filename, -d filename, {command} Predefined Shell Variables : argv, cdpath, cwd, echo, fignore, filec, hardpaths, histchars, history, home, ignoreeof, mail, nobeep, noclobber, noglob, nonomatch, notify, path, prompt, savehist, shell, status, time, verbose Built-in Commands : :, alias [name [def]], unalias pattern, kill -l, limit [-h] [resource [max-use]], continue, break, cd [dir], chdir [dir], dirs [-l], echo [-n] list, eval argument..., exec command, exit [(expr)], glob wordlist, goto label, hashstat, history [-hr] [n], login [username| -p], logout, bg [%job ...], fg [%job], jobs[-l], kill [-sig] [pid] [%job] ..., %[job] [&], stop %jobid ..., stop pid ..., suspend, nice [+n|-n] [command], nohup [command], notify [%job] ..., onintr [-| label], pushd [+n|dir], popd [+n], rehash, repeat count command, set [var[=value]], set var[n]=word, setenv [VAR [word]], shift [variable], source [-h] name, time [command], umask [value], unhash, unlimit [-h] [resource], unset pattern, unsetenv variable, wait, @[var=expr], @[var[n]=expr] #!/usr/bin/csh foreach var (wordlist) while (expr) ... ... continue; break; end end if (expr) then switch (string) ... case label: else if (expr2) then ... ... breaksw else default: ... ... endif breaksw endsw
- 수치계산 : expr 계산식
C Shell의 실행시 처리 순서
- Login shell : /etc/.login, ~/.cshrc, ~/.login, (.history,) ~/.logout
- 일반적 shell : ~/.cshrc
C Shell의 Options
-b : -c : Execute the first argument -s : Take commands from the standard input. -t : Read and execute a single command line. -e : -f : Fast start (.cshrc, .login을 수행하지 않는다.) -i : -n : Parse (interpret), but do not execute commands. -v : -V : -x : -X :
/etc/.login
#ident "@(#)login.csh 1.6 93/09/15 SMI" if (! -e .hushlogin ) then /usr/sbin/quota /bin/cat -s /etc/motd /bin/mail -E switch ( $status ) case 0: echo "You have new mail." breaksw; case 2: echo "You have mail." breaksw; endsw endif
.login
# @(#)local.login 1.3 93/09/15 SMI setenv TERM vt100 setenv EDITOR vi setenv LANG ko loadkeys korea_5 umask 000 stty erase ^?
.cshrc
# @(#)cshrc 1.11 89/11/29 SMI set path=(. /opt/cobol/bin /usr/bin /usr/openwin/lib /lib $HOME/bin) set path=($path $IEAPHOME/bin $IEAPHOME/startup) set cdpath=(/home3/skci) set prompt="[`hostname`:`pwd`]" set history=32 setenv IEAPHOME /homeb/ieap10 setenv LD_LIBRARY_PATH /opt/cobol/coblib:/usr/ccs/lib:/usr/lib alias cd 'cd \!*; set prompt="[`hostname`:`pwd`]"' alias cp cp -i alias dir '/bin/ls -alF \!* | more' alias dird '/bin/ls -alF \!* | grep / | more' alias ff 'find . -name \!*\* -print' alias h history alias ls ls -F alias mv mv -i alias rm rm -i alias sql 'cd ~/sql;sqlplus apps/apps @sqlplus.sql' alias we 'vi -c "source ~/vt220.key" \!*'
.history
set cdpath=(~ /home3/skci ~/bin /app/applmgr/10.7/common /home5/SPIS);clear cd sql;sqlplus apps/apps @init-pnus.sql netstat -s | more
.logout
clear echo ' ' echo ' ' echo ' <<< Logout time >>>' echo ' ' echo " `date`" echo ' ' echo ' '