Hi all,
I’m a bit stumped on how to handle formatting the output of a remotely
executed file if anyone has suggestions or pointers. Executing the
command ‘db-update.sh’ on my remote box, gives me a nice formatted
output like this:
App Deleted:
Trial Counter: 2
Trial Details ID: 0
But if I execute the following piece of code in a .rb file:
cmd = “db-update.sh”
stdout = “”
session.exec!(cmd) do |channel, stream, data|
stdout << data if stream == :stdout
end
print ‘Result: %s’ % stdout
I get this:
“App Deleted:\n PreTrial Counter: 2\n Trial Details ID:
0\n------------------- ------------------- --------------------\n”
I’ve tried multiple variations of printing the result but I’m not
understanding why it’s not converting the \n to a newline but assume
it’s to do with how I’m processing the output?