I am creating a Subversion post-commit hook . I need to force one command to be output to STDERR so that the hook, after committing, sends a message back to the client.
How to force STDOUT to use STDERR?
In this simplified example, a file exists foo, but bardoes not work.
ls: bar: No such file or directory
foo
I want to send STDOUT to STDERR. I assumed I could do this with help >&2, but it does not seem to work.
I was expecting the following example of redirecting STDOUT to STDERR, and that /tmp/testwould contain the output and error for the command. But instead, it seems that STDOUT is never redirected to STDERR, and therefore /tmp/testonly contains an error from the command.
# ls foo bar >&2 2>/tmp/test
foo
# cat /tmp/test
ls: bar: No such file or directory
What am I missing?
CentOS, Unbuntu, FreeBSD MacOSX.