The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Ping command aladdin UNIX for Dummies Questions & Answers 3 12-05-2006 12:54 PM
UNable to find ping command swepaul UNIX for Dummies Questions & Answers 3 05-29-2005 11:17 PM
-c option in ping command Deepa Shell Programming and Scripting 3 05-31-2002 03:05 AM
how to use PING command efficiently hoang IP Networking 1 04-16-2002 02:04 AM
About ping command Papa Deoo IP Networking 2 09-20-2001 09:50 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 09-18-2001
Registered User
 

Join Date: Sep 2001
Location: Sweden
Posts: 2
Unhappy About ping command

Hi!

I have small problem. I want to ping a server and the result shouldn't be printed in the browser window, just become a value.

Here you can see the script that I have:

<?
$command="ping linux.com -t ttl -c1 | tail -1 | awk '{print $4 \" \" $5}'";
$output = system($command);
system("exit(0)");
echo "DATA: $output";
?>

When I run this in my browser the resualt will be as follow:

33.1/33.1/33.1 ms DATA: 33.1/33.1/33.1 ms

The echo value is just a test for me to see if the $output value is OK.

What I want is that the value before DATA: 33.1/33.1/33.1 ms
shouldn't be viewed in the browser just DATA: 33.1/33.1/33.1 ms

Could someone please help me with this problem?

Best Regards

Peter Håkansson
Forum Sponsor
  #2  
Old 09-19-2001
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
Re: About ping command

Quote:
Originally posted by Papa Deoo

Here you can see the script that I have:
No we can't because you enclosed your script in angle brackets.

Anyway, change your script (looks like PHP?) to:
Code:
<?
$command="ping linux.com -t  ttl -c1 | tail -1 | awk '{print \"DATA: \" $4 \" \" $5}'";
system($command);
?>
You don't need the second system call, and you dont need to assign the output of the first to a variable unless you need to check that it succeeded (the output of your command is displayed automatically)

HTH

removed html tags / added code tags --oombera

Last edited by oombera; 02-16-2004 at 07:17 AM.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0