옵션 |
|
#include <stdio.h> int main() { fprintf(stdout, "this is 1 stdout \n"); fprintf(stderr, "this is 2 stdERR!!!\n"); fprintf(stdout, "this is 3 stdout \n"); fprintf(stderr, "this is 4 stdERR!!!\n"); fprintf(stdout, "this is 5 stdout \n"); fprintf(stderr, "this is 6 stdERR!!!\n"); return 0; } |
# ./a.out this is 1 stdout this is 2 stdERR!!! this is 3 stdout this is 4 stdERR!!! this is 5 stdout this is 6 stdERR!!! # ./a.out > d.txt 2>&1 # cat d.txt this is 2 stdERR!!! this is 4 stdERR!!! this is 6 stdERR!!! this is 1 stdout this is 3 stdout this is 5 stdout |
출처 | 나 |