what is the meaning of the following redirection

Hello bash experts.,

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.

command 2>&1 1>&2

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.

Sorry for being critical Scrutinizer but the 1 filehandle is STDOUT.

Reference: Solaris 10u7 bash man page

Deleted... misread myself.

You are right of course. :stuck_out_tongue: