On 04/10/2017 12:46 PM, Gordon Messmer wrote:
I did understand. It doesn't matter if 2>file appears before the ssh
arguments, or at the end. In both cases, ssh's stderr will be written
to a local file. It is incorrect to say that the former example would
redirect wc's stderr, and not ssh.
Try this: put the ssh command in a shell script, let's say sshscript.sh.
Then, ./sshscript.sh 2>stderr.log should do what you want. Please
note that I haven't tried this, which is why I write "should," not
"will."