Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Would like to make a system call without displaying msg to STD OUT

Reply
Thread Tools

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

 
 
desert.fox11@yahoo.com
Guest
Posts: n/a
 
      03-24-2006
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
 
Reply With Quote
 
 
 
 
John W. Krahn
Guest
Posts: n/a
 
      03-24-2006
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
 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      03-24-2006
<> 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.
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      03-24-2006
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


 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      03-24-2006
<> 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
 
Reply With Quote
 
Bart Lateur
Guest
Posts: n/a
 
      03-25-2006
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.
 
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
Read .msg attachment from a mail(.msg) akila_natarajan Java 0 05-13-2011 07:35 AM
[ANN] ruby-msg-1.3.1 (outlook msg lib) and ruby-ole-1.2.1 Charles Lowe Ruby 0 08-22-2007 01:13 AM
[ANN] ruby-msg-1.2.17 (converter for outlook msg files) Charles Lowe Ruby 0 05-13-2007 06:55 AM
/usr/bin/ld: ../../dist/lib/libjsdombase_s.a(BlockGrouper.o)(.text+0x98): unresolvable relocation against symbol `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostre silverburgh.meryl@gmail.com C++ 3 03-09-2006 12:14 AM
Would like to make a cell look like a dropdown box in the edit mode Alex ASP .Net 0 04-25-2004 09:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57