Reputation: 105
This is what I'm doing:
cmd = "echo foo\n echo bar"
out = `#{cmd}`
In Linux I have "foo\nbar". In Windows I have "foo". Why is that? How to fix?
Upvotes: 2
Views: 125
Reputation: 369424
It seems like cmd.exe
read until the newline (\n
) and ignore remaining part.
You can use &&
instead to combine to commands:
cmd = "echo foo && echo bar"
out = `#{cmd}`
# => "foo \nbar\n"
Upvotes: 4