Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > System Command Results

Reply
Thread Tools

System Command Results

 
 
Gary
Guest
Posts: n/a
 
      04-30-2004
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


 
Reply With Quote
 
 
 
 
Richard Morse
Guest
Posts: n/a
 
      04-30-2004
In article <C6vkc.386$nN6.54@lakeread06>, "Gary" <(E-Mail Removed)>
wrote:

> 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

--
Pukku
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      04-30-2004
Gary <(E-Mail Removed)> wrote:

> 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!


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      05-01-2004
Gary wrote:
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I make this more efficient? (combining DataSet results with the results of a DB lookup.) Ken Fine ASP .Net 3 07-23-2008 08:11 AM
suppress opening command window after using os.system command boriq Python 4 06-12-2008 10:42 AM
Net FTP -- Size showing different results on AIX system and Linux system fmbright Perl Misc 8 08-10-2006 09:43 PM
Prefix increment/decrement results in lvalue, but postfix one results in rvalue? lovecreatesbeauty C++ 8 09-12-2005 10:23 PM
Displaying results as "pages" of a JTable and sorting across all results ... Monique Y. Mudama Java 1 06-28-2005 01:01 AM



Advertisments