Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Output of a command

by ysth (Canon)
on Jul 30, 2008 at 05:10 UTC ( [id://701021]=note: print w/replies, xml ) Need Help??


in reply to Output of a command

"ebs --version" probably writes output to stderr, not stdout. Also, you should be saying $command = 'ls';; if you left quotes off for the ebs command, that would cause you trouble.

Replies are listed 'Best First'.
Re^2: Output of a command
by Niel (Initiate) on Jul 30, 2008 at 05:33 UTC
    YES you are right. Thanks on this!!!!! The output is going to STDERR.
    Now my question is, should it go to STDERR when its not an error? this is just get the information of the product!!!!
        It's a pet peeve of mine for help text explicitly requested to go to stderr. If I asked for it, and it's long, please put it on stdout so I don't have to work harder to pipe it into $PAGER. Of course, if something's wrong and you need to give me an error message with some helpful text, it's fine to put it on stderr to lessen the chance of breaking my pipes.
      You could be using IPC::Open3 , it will get output from STDOUT,STDERR .
      Some examples (*nix) if you only need one stream of the commands output:
      $command = "curl -D- http://www.perlmonks.org"; # mixes stderr and st +dout # stdout only, no stderr noise $stdout_only = `$command 2>/dev/null`; # stderr only, no stdout noise $stderr_only = `$command 2>&1 1>/dev/null`; # both mixed up (usually not a good idea!) # Aliens suggestion to use open3 is better in this case. $brundlefly = `$command 2>&1`;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://701021]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 06:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found