I disagree:
Code:
#!/bin/ksh
#
# test.sh : demonstrate redirection
#
#
echo "I am stdout"
echo "I am stderr" >&2
Code:
# ./test.sh > log1
I am stderr
# cat log1
I am stdout
Code:
# ./test.sh 2>&1 > log2
I am stderr
# cat log2
I am stdout
Code:
# ./test.sh > log3 2>&1
# cat log3
I am stdout
I am stderr
The order of redirection is important because if the duplication happens from 2 to 1 before redirection of 1, error output is redirected to fd1 ( stdout ) and standard output is redirected elsewhere. On the other hand if it happens afterwards the duplication is to "the same place as standard output"
|