CnUnix

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ CnUnix ] in KIDS
글 쓴 이(By): dal (ⓓⓐⓛ *)
날 짜 (Date): 1994년09월18일(일) 11시47분04초 KDT
제 목(Title): debussy님 control-c




trap 이란 걸 써보시죠.

korn shell 에 있는건데.

예를 들어서

trap 'echo hi' 2 
하시면
control-c 할때 hi라고 대신 나오죠.

man ksh를 카피해서 오리면

     trap [ arg ] [ sig ] ...
          arg is a command to be read and executed when the shell
          receives signal(s) sig.  (Note that arg is scanned once
          when the trap is set and once when the trap is  taken.)
          Each sig can be given as a number or as the name of the
          signal.  Trap commands are executed in order of  signal
          number.  Any attempt to set a trap on a signal that was
          ignored on entry to the current shell  is  ineffective.
          An attempt to trap on signal 11 (memory fault) produces
          an error.  If arg is omitted or is -, then all  trap(s)
          sig  are reset to their original values.  If arg is the
          null string then this signal is ignored  by  the  shell
          and by the commands it invokes.  If sig is ERR then arg
          will be executed whenever a command has a non-zero exit
          code.  This trap is not inherited by functions.  If sig
          is 0 or EXIT and the trap statement is executed  inside
          the  body  of  a function, then the command arg is exe-
          cuted after the function completes.  If  sig  is  0  or
          EXIT  for a trap set outside any function then the com-
          mand arg is executed on exit from the shell.  The  trap
          command  with  no  arguments  prints a list of commands
          associated with each signal number.

그리고..
앙마아저씨가 말씀하신거 같이..
signal.h를 보면
번호 설명이 나와있으니까..
..

#define SIGINT     2    /* interrupt, generated from terminal special char */
#define SIGTSTP   18    /* (@) interactive stop */
같이 번호를 바꾸시면 되고.


달님
[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.