Shell 스크립트의 내장변수 + exit code
2011.11.16 20:01
원문 : http://www.ischo.net -- 조인상 // 시스템 엔지니어
Writer : http://www.ischo.net -- ischo // System Engineer in Replubic Of Korea
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
원문 : http://www.ischo.net -- 조인상 //시스템 엔지니어
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
Shell 내장변수
   $$ : 해당 프로세스의 PID값
   $? : 가장 최근에 실행한 명령의 종료값
   $# : 프로그램에 전달된 인수의 개수
   $0 : 명령수행시 명령의 이름을 기억하는 변수값
   $n : 전달된 n번째 인수(ex:$1,$2)
   $* : 전달된 인수들 전체를 하나의 문자열로 표시함
   $@ : 전달된 인수들 전체를 문자열의 목록으로 표시함
   $! : 마지막으로 실행된 백그라운드 프로세스 pid값
Shell exit code ( 내장변수 $? 에 저장되어 다음 쉘에서 활용가능 )
  0 : Successful completion of the command
  1 : General unknown error
  2 : Misuse of shell command
  126 : The command can't execute
  127 : Command not found
  128 : Invalid exit argument
  128+x : Fatal error with Linux signal x
  130 : Command terminated with Ctrl-C
  255 : Exit status out of range