Would like to make a system call without displaying msg to STD OUT

Discussion in 'Perl Misc' started by desert.fox11@yahoo.com, Mar 24, 2006.

  1. Guest

    Hi,
    I'll try to say this succinctly. I make a call using system "unzip -o",
    "$filename" which calls a utility unzip that has 'status' messages
    display to std out. This is fine, however, can I re-direct ( or at the
    very least suppress ) these messages.
    eg. " Inflating README.txt........"
    Any suggestion is appreciated.




    --
    Sent by desert.fox11 from yahoo within field com
    This is a spam protected message. Please answer with reference header.
    Posted via http://www.usenet-replayer.com
     
    , Mar 24, 2006
    #1
    1. Advertising

  2. Re: Would like to make a system call without displaying msg to STDOUT

    wrote:
    > I'll try to say this succinctly. I make a call using system "unzip -o",
    > "$filename" which calls a utility unzip that has 'status' messages
    > display to std out. This is fine, however, can I re-direct ( or at the
    > very least suppress ) these messages.
    > eg. " Inflating README.txt........"
    > Any suggestion is appreciated.


    perldoc -q "How can I capture STDERR from an external command"


    John
    --
    use Perl;
    program
    fulfillment
     
    John W. Krahn, Mar 24, 2006
    #2
    1. Advertising

  3. Anno Siegel Guest

    <-mobilphone.net> wrote in comp.lang.perl.misc:
    > Hi,
    > I'll try to say this succinctly. I make a call using system "unzip -o",
    > "$filename" which calls a utility unzip that has 'status' messages
    > display to std out. This is fine, however, can I re-direct ( or at the
    > very least suppress ) these messages.
    > eg. " Inflating README.txt........"
    > Any suggestion is appreciated.


    Look for -q in man zip.

    Anno
    --
    If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers.
     
    Anno Siegel, Mar 24, 2006
    #3
  4. wrote:
    > I'll try to say this succinctly. I make a call using system "unzip
    > -o", "$filename" which calls a utility unzip that has 'status'
    > messages display to std out. This is fine, however, can I re-direct


    On most command shells that I know about you can use the ">" to redirect
    stdout into a file. Just redirect it to /dev/null

    > (or at the very least suppress ) these messages.


    Typically that question would be answered in the documentation of the tool
    that you are using.
    Many applications have an option like "-s" for silent or similar.

    Now, what's your Perl question?

    jue
     
    Jürgen Exner, Mar 24, 2006
    #4
  5. <-mobilphone.net> wrote:
    > Hi,
    > I'll try to say this succinctly. I make a call using system "unzip -o",
    > "$filename"



    perldoc -q vars


    > which calls a utility unzip that has 'status' messages
    > display to std out.



    Is that really what your system() call looks like?

    It is a strange hybrid of the one arg form:

    system "unzip -o $filename"

    and the LIST form

    system "unzip -o", $filename

    where the list form attempts to run a command whose name is
    eight characters long.

    The proper LIST form would be something like:

    system 'unzip', '-o', $filename


    > This is fine, however, can I re-direct ( or at the
    > very least suppress ) these messages.



    You can use shell redirection with the one arg form:

    system "unzip -o $filename >/dev/null"


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Mar 24, 2006
    #5
  6. Bart Lateur Guest

    wrote:

    >I'll try to say this succinctly. I make a call using system "unzip -o",
    >"$filename" which calls a utility unzip that has 'status' messages
    >display to std out. This is fine, however, can I re-direct ( or at the
    >very least suppress ) these messages.
    > eg. " Inflating README.txt........"
    >Any suggestion is appreciated.


    Perhaps you are actually interested in reading those messages into your
    program. The simplest way to achieve that, is to use backticks
    ("`command`"), AKA qx. See "qx" in perlop.

    But that'll wait till the program is finished before returning. If you
    want an intermediate update, you can call

    open STATUS, "command |";

    and read the output from the command through ordinary readline calls.

    while(<STATUS>) { ... }

    If you still want more, like piping into the command's STDIN or read its
    STDERR separately, check out the modules IPC::Open2 and IPC::Open3. Both
    come with Perl.

    --
    Bart.
     
    Bart Lateur, Mar 25, 2006
    #6
    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. Alex
    Replies:
    0
    Views:
    422
  2. akila_natarajan

    Read .msg attachment from a mail(.msg)

    akila_natarajan, May 13, 2011, in forum: Java
    Replies:
    0
    Views:
    423
    akila_natarajan
    May 13, 2011
  3. Charles Lowe
    Replies:
    0
    Views:
    256
    Charles Lowe
    May 13, 2007
  4. Charles Lowe
    Replies:
    0
    Views:
    190
    Charles Lowe
    Aug 22, 2007
  5. john.swilting
    Replies:
    1
    Views:
    203
    -berlin.de
    Mar 27, 2007
Loading...

Share This Page