[1] 셸의 개념
어떤 운영체제는 커널에 명령어 해석기를 포함하고 있다. Windows XP와 UNIX 같은 다른 운영체제는 명령어 해석기를 작업이 시작되거나, 사용자가(대화형 시스템 상에서) 처음 로그온할 때 수행되는 특수한 프로그램으로 취급한다. 선택할 수 있는 여러 명령어 해석기를 제공하는 시스템에서 이 해석기는 셸(Shell)이라고 불린다.
Shell
-Commend Processor or Command Interpreter
-Program to be interpreted by reading the command enterd by the user
Shell Script
-Collect the combination of the comands that can be interpreted by shell
-Create a bath file
C Shell
-As provided by default in UNIX Shell, uses the most general
-The C Shell is largely two things
(1) the C shell program name itself is csh(/bin/csh).
(2) Is one of the family of C Shell tcsh, one of the C Shell providing superior functionality compared to the other shell.
Bourne Shell
[2] 셸 스크립트 만들기
-실행: vim test.sh
-Define in the first line you want to use any of the Shell
- #!/bin/sh
- #!/bin/csh
※스크립트 내에서 글을 작성하려면 Insert Mode로 바꿔야 한다. 즉 Insert를 누른다.
※빠져 나올 때는 Ex mode로 바꾼다. 즉, Esc 키를 누른뒤 :wq 를 쳐준다.
예제1) hello.sh file 만들어 보자
vim test.sh
#!/bin/sh
#hello.sh
echo "Hello World"
실행 시키려고 ./test.sh 를 치니까 'Permission denied' 라는 메세지가 나왔다.
cd test 명령어로 test파일 안으로 들어 간뒤.
vi hello.sh 명령어를 치니, shell 창이 다시 만들어 졌다. 위의 명령어 들을 다시 친 뒤,
빠져나온뒤 ls -l 로 만들어 진것을 확인. 하지만 접근 권한을 보면 실행이 안되게 되있음을 볼 수 있다.

chmod +x hello.sh 명령어로 접근 권한에 x(실행)을 추가 하였다.
./hello.sh 명령어를 치니 Hello World가 실행 되었다.
[3] 셀의 기능들
- It includes features such as variables, conditions loops and functions.
- Available function: variable/ control statement/ function/ parameter passing
/ interrupt handling
예제2) exval 예제
vi exval.sh - 셀 창으로 들어가 진다.
#!/bin/sh
#exval.sh
myvar="ubuntu"
echo $myvar
echo "$myvar"
echo '$myvar'
echo /$myvar
echo \$myvar
exit 0
셀 창을 빠져 나온 뒤
sh exval.sh 명령어로 실행 시켜 본다.
예제3) if문 실행시켜보기, * 출력해 보기, 구구단 출력해보기
Standard input and output
-Must be able to accept any input from ant resource to any program, whether an object should output.
-Standard input: Reading data method/ device
-Standard output: Outputting data method/ device
Redirection of Standard output
-Redirection: To send the file to the standard output
-If you want to send a command to the file, you need to type ">" + (file name)

-Append to existing fiel to standard output, use the ">>"
※You use Pipeline when you want to obtain the output from other program input.
※ 명령어를 실행 했을 때 너무나 많은 양이 실행 되면 Ctrl+C 로 인터럽트를 발생 시켜
종료 시킬 수 있다.
※wc: Gives inf about the number of lines of the file, the number of the letters, the number of words.