printing output of ping command
From: TapasranjanMohapatra (TapasranjanMohapatra_at_infosys.com)
Date: 02/23/05
- Next message: Ankur Gupta: "Re: printing output of ping command"
- Previous message: John W. Krahn: "Re: how to handle multiline feedback from backticksoperator?"
- Next in thread: Ankur Gupta: "Re: printing output of ping command"
- Reply: Ankur Gupta: "Re: printing output of ping command"
- Reply: Chris Devers: "Re: printing output of ping command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 23 Feb 2005 20:02:57 +0530 To: <beginners@perl.org>
Hi All,
I have a script as follows
----------------------------
my $host = shift;
my $count = shift;
my $result = `ping -c $count $host`;
if($result =~ m/$count packets transmitted, $count packets received/)
{
$success = 1;
}
print "$result\n";
----------------------------
Now, when I run the script, the ping is executed the result is stored in the $result variable and printed at the last statement. When the count is a big number, I have to wait till the command finishes and then it prints at one shot at the last line.
Is it possible to get the output printed as it is seen while running the ping command? I mean instead of printing at one shot at the end, I want to print line by line as the ping is being executed. Is it possible?
TIA
Tapas
- Next message: Ankur Gupta: "Re: printing output of ping command"
- Previous message: John W. Krahn: "Re: how to handle multiline feedback from backticksoperator?"
- Next in thread: Ankur Gupta: "Re: printing output of ping command"
- Reply: Ankur Gupta: "Re: printing output of ping command"
- Reply: Chris Devers: "Re: printing output of ping command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|