- C Shell 기본
- C Shell의 유용한 특징
- C Shell의 실행시 처리 순서
- C Shell의 Options
- /etc/.login
- .login
- .cshrc
- .history
- .logout
- 참고 문헌
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[분리기호](분리기호.md) -f File file
NR : 레코드 번호
환경변수가 있는지 검사
if ($?GROUP == 0) then
set GROUP="init"
setenv GROUP "init"
endif
C Shell의 유용한 특징
Filename Completion : ESC, ^D, ~[user](user.md)
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 : <, <, >!, >&, >&!, >>, >>&, >>!, >>&!
Variable Substitution : $var = ${var}
$var, $var[index-index], $#name, $0, $n = $argv[n], $* = $argv[*](*.md),
$?var, $?0, $$, $<, $#argv, $status
Filename Substitutions : *, ?, [ ... ], { str, str, ... }, ~[user](user.md)
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]](def].md), unalias pattern, kill -l,
limit [-h] [resource [max-use]](max-use].md), continue, break,
cd [dir], chdir [dir], dirs [-l], echo [-n](-n.md) list,
eval argument..., exec command, exit [(expr)]((expr).md), glob wordlist,
goto label, hashstat, history [-hr] [n], login [-p](username|), logout,
bg [%job ...], fg [%job], jobs[-l], kill [-sig] [pid] [%job] ..., %[job] [&](&.md),
stop %jobid ..., stop pid ..., suspend,
nice [+n|-n] [command], nohup [command], notify [%job] ..., onintr [label](-|),
pushd [+n|dir], popd [+n](+n.md), rehash, repeat count command,
set [var[=value]], set var[n]=word, setenv [VAR [word]], shift [variable](variable.md),
source [-h] name, time [command], umask [value](value.md),
unhash, unlimit [-h] [resource](resource.md), unset pattern, unsetenv variable, wait,
@[var=expr], @[var[n]=expr](n]=expr.md)
#!/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`](`hostname`:`pwd`.md)"
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`](`hostname`:`pwd`.md)"'
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 ' '
참고 문헌
최종 수정일: 2024-09-30 12:26:18
이전글 :
다음글 :