System Command Results

Discussion in 'Perl Misc' started by Gary, Apr 30, 2004.

  1. Gary

    Gary Guest

    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
    Gary, Apr 30, 2004
    #1
    1. Advertising

  2. In article <C6vkc.386$nN6.54@lakeread06>, "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.
    >
    > G


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

    HTH>
    Ricky

    --
    Pukku
    Richard Morse, Apr 30, 2004
    #2
    1. Advertising

  3. 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.



    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
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Apr 30, 2004
    #3
  4. 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
    Jürgen Exner, May 1, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Monique Y. Mudama
    Replies:
    1
    Views:
    442
    Monique Y. Mudama
    Jun 28, 2005
  2. lovecreatesbeauty
    Replies:
    8
    Views:
    1,629
    Old Wolf
    Sep 12, 2005
  3. boriq
    Replies:
    4
    Views:
    566
    Tim Golden
    Jun 12, 2008
  4. Ken Fine
    Replies:
    3
    Views:
    519
    Steven Cheng [MSFT]
    Jul 23, 2008
  5. fmbright
    Replies:
    8
    Views:
    200
Loading...

Share This Page