On a windows system, I execute a command using the ‘backtick’ notation,
but I can’t see the output of the command.
For example:
echo Hello --> no output
mvn.bat -version --> no output
date --> no output
When I enter these commands in irb, I can see the correct output. What
irritates me in addition to that is that I can see the output of several
commands, for example
If you mean there’s not output on your terminal while you are calling
this from a ruby program, that is perfectly normal. The idea behind the
backticks is that instead of outputting the result to the terminal,
the generated text is the value of the expression. You do see it in irb
because irb prints the values of the expressions it evaluates.
Try out:
txt = echo stuff
puts “got #{txt} from echo”
When I enter these commands in irb, I can see the correct output. What
irritates me in addition to that is that I can see the output of several
commands, for example
cvs --help --> gives me the CVS-Help-output
This is normal, as cvs gives its help on standard error, which is not
taken by the backticks and goes to your terminal.
If you simply want to execute a command and see it’s output in a
terminal, use system “command” rather than the backticks.