stadard error가 프로세스 수행하면 막 뜨는데
이걸 파일이나 어디 다른데다가 기록하게 할 수 없는지
방법을 찾아야했는데 이런게 있다. 괜찮네.. 간단하고..

std 관련 설명

[a] stdin - Use to get input (keyboard) i.e. data going into a program.

[b] stdout - Use to write information (screen)

[c] stderr - Use to write error message (screen)

I/O streams 숫자의 의미

The Unix / Linux standard I/O streams with numbers:

Handle

Name

Description

0

stdin

Standard input

1

stdout

Standard output

2

stderr

Standard error

1. stderr 를 file에 쓰는 경우

만약에error.log 파일에 stderr를 쓰려면

아래처럼 수행한다:

$ program-name 2> error.log

$ command1 2> error.log

2. stderr 와 stdout 을 file에 쓴다.

아래처럼 수행한다:

$ command-name &>file

혹은:

$ command > file-name 2>&1

다른 방식으로 하려면:

# find /usr/home -name .profile 2>&1 | more

3. stderr 를 stdout 으로

아래처럼 수행한다:

$ command-name 2>&1

반응형

+ Recent posts