|Keep It Simple, Stupid|
Ssh and qxby cbeckley (Curate)
|on Mar 30, 2017 at 18:04 UTC||Need Help??|
It actually took a little digging to find out how to properly handle the output and the various return codes of qx when executing an ssh command.
Why would you actually want to do such a thing to begin with? You wouldn't. Don't do it. Stop! For the love of ...
If, however, you have a machine who's operating system hasn't had a vendor supported upgrade any time this century, you may not have a choice.
I feel your pain. It runs deep, share it with me.
The hash you pass in looks like this:
And you invoke it thusly:
Unfortunately the values you end up with in
are, for both the OS and SSH, implementation dependent, which is just one of the reasons you shouldn't be doing this if you have a choice.
If anybody finds this useful, you have my condolences.
Update: haukex has a great write up regarding alternatives to qx/backticks here Calling External Commands More Safely. My Perl was too old for the ones I tried, but afoken has indicated that piped opens are available even in 5.004.