in reply to backticks fail to capture stderr even with explicit redirection
Your conclusions are wrong. STDERR is being captured and stored in $x.
$ cat asdf #!/bin/sh echo "line 1" echo "line 2" echo "line 3" >&2 echo "line 4" >&2 $ perl -le'$x=`./asdf 2>&1`; print "<<Captured $x>>"' <<Captured line 1 line 2 line 3 line 4 >>
Using backticks in list context will split the lines if that's what you want.
$ perl -e'print "Captured $_" for `./asdf 2>&1`;' Captured line 1 Captured line 2 Captured line 3 Captured line 4
|
|---|