I want to store output of a ssh command as a string, so that I could do some scripting around it, like so:
ssh_command = %x(ssh -t -t [email protected])
The problem is that 'ssh_command' does not actually seems to store any string. It's supposed to store this(for a non-valid IP):
ssh: connect to host ip.ip.ip.ip port 22: No route to host
It does output it in the irb but not as a string referenced by the 'ssh_command' variable.
Interestingly enough, the following works as expected:
uname_cmd = %x(uname -a)
In this case, when I print 'uname_cmd', I do get the string output back, as expected.
So my question is, is there a way to store the output of a ssh command as a regular string, like it works with uname?
Thanks,