System Command Results

G

Gary

I can see how to check success or failure of a system command but how can I
see what was actually returned by the command to be able to do further
processing.

I know I could write the answer to a file and read the file but it seems
pretty crude.

G
 
R

Richard Morse

"Gary" <[email protected]> said:
I can see how to check success or failure of a system command but how can I
see what was actually returned by the command to be able to do further
processing.

I know I could write the answer to a file and read the file but it seems
pretty crude.

G

look at the 'qx' fuction (or, if you prefer, backticks (``)).

HTH>
Ricky
 
T

Tad McClellan

Gary said:
I can see how to check success or failure of a system command but how can I
see what was actually returned by the command to be able to do further
processing.


print 'system returned: ', system('some command'), "\n";

I know I could write the answer to a file and read the file but it seems
pretty crude.


Huh?

Oh, you do NOT want what was returned from system().

You appear to want the OUTPUT generated from system().

The docs for system() tell how to do that.

perldoc -f system

... This is not what you want to use to capture the output from
a command, for that you should use merely ...


Please don't ask thousands of people to read the docs for you!
 
J

Jürgen Exner

Gary said:
I can see how to check success or failure of a system command but how
can I see what was actually returned by the command to be able to do
further processing.

I know I could write the answer to a file and read the file but it
seems pretty crude.

Which part of the third paragraph of the man page for system() do you not
understand?

perldoc -f system:

[...] This is
*not* what you want to use to capture the output from a command,
for that you should use merely backticks or "qx//", as described
in the section on "`STRING`" in the perlop manpage. [...]

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top