-
Managing Input and OutputIoT 과정 2017. 7. 7. 16:10반응형
Process
+----- file descriptor table { 0, 1, 2, .... } 0 표준 입력, 1 표준 출력, 2 표준 에러, 3~9까지 범용으로 쓰일 수 있다. 10은 평범한 방법으로 못 쓴다.
+----- file table { tty , ... } tty는 0, 1, 2 에 의해 가리켜진다.Managing Input/Output
Redirection of input : cmd < data_file mail user13 < mail.txt
Redirection of output : cmd > data_file
Redirection of input text : cmd << end_file_marker$ mail user13 << XXX // XXX, here, EOF 등등 쓸 수 있다.
> hello - my name is ...
> I hereby ...
> I ...
> ..
> ...
> I need
> XXXPiping of output : cmd | next_commandRedirection of errors : cmd 2> error_file
Run in background : cmd &sh // $ls -al 수행시+ // fork() 수행, child shell 생성+-----------+parent childshell shell exec() /usr/bin/ls
+----------+-------------+wait()------+ // child shell exit 수행, parent shell 은 wait() 수행, 그 뒤 원래 쉘에 프롬포트 $가 뜬다.$ exec ls -al // 이것을 하면 fork 수행을 안하므로, 본 쉘은 명령어 수행후 마치 child shell 이 exit하 듯이 터미널은 종료된다.Data-Flow File Descriptor 3-9Open file for reading : exec [3-9]< data_file
Open file for write/overwrite : exec [3-9]> data_file
Open file for write/append : exec [3-9]>> data_file
Redirection of output : command >&[3-9]Close input file descriptor : exec [3-9]<&-Close output file descriptor : exec [3-9]>&-print text_file | while read var
while read var ... done < text_file
반응형'IoT 과정' 카테고리의 다른 글
LINUX KERNEL & DEVICES (0) 2017.07.17 Enterprise Linux System - Adnministration 시작 (0) 2017.07.17 Managing Input and Output (0) 2017.07.07 Functions and Function Libraries (0) 2017.07.07 Array Variable (0) 2017.07.07 Program Loops (0) 2017.07.07