I was doing some experimentations to better understand the following redirection.,
$Output = `sh -c \"$Cmd 2>&1 1>&2\"`;
It is actually the line used in one of the perl program, but the technique i am trying to understand is related to shell scripting.
So is there any better explanation or reference where i can understand, which will do what and what is the flow in which it get executed ?! What happens to the output, and what will happen to the stderror ?
After playing around with a perl program I whipped up that prints to STDERR and STDOUT I found doing: 2>&1has the exact same end result as 2>&1 1>&2. Maybe one of the shell scripting gurus here can correct me if I am wrong.
Imho "1>&2" is indeed meaningless here, because in this case "2>&1" already redirected stderror(2) to whatever stdout(1) was pointing to, so they are both pointing to the same thing.