How do I ping each element


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How do I ping each element
# 1  
Old 01-05-2009
How do I ping each element

@listip is a list of ips

my $PING = "/usr/sbin/ping";

for ($lindex = 0; $lindex <= $#listip; $lindex++) {
print $listip[$lindex] . "\n";
$PING $listip[$lindex] ;
}
# 2  
Old 01-05-2009
You're missing a system() there (perldoc -f system)
That, and it's enough to interate to $lindex<$#listip
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Ping test sends mail when ping fails

help with bash script! im am working on this script to make sure my server will stay online, so i made this script.. HOSTS="192.168.138.155" COUNT=4 pingtest(){ for myhost in "$@" do ping -c "$COUNT" "$myhost" &&return 1 done return 0 } if pingtest $HOSTS #100% failed... (4 Replies)
Discussion started by: mort3924
4 Replies

2. UNIX for Advanced & Expert Users

Array Element

This question is for someone that's more familiar with Array Element. I need to know if the maximum array element that can be assigned is 1024 and if its so, Is there a workaround solution when the counter exceeded 1024? param_array="$param_nam" counter=$counter+1 #to avoid space... (3 Replies)
Discussion started by: cumeh1624
3 Replies

3. Shell Programming and Scripting

How to get reason for ping failure using perls Net::Ping->new("icmp");?

Hi I am using perl to ping a list of nodes - with script below : $p = Net::Ping->new("icmp"); if ($p->ping($host,1)){ print "$host is alive.\n"; } else { print "$host is unreacheable.\n"; } $p->close();... (4 Replies)
Discussion started by: tavanagh
4 Replies

4. Shell Programming and Scripting

Print the row element till the next row element appear in a column

Hi all I have file with columns F3 pathway CPS F2 H2 H4 H5 H6 no pathway CMP H7 H8 H9 H10 My expected output is F3 pathway CPS F2 pathway CPS (10 Replies)
Discussion started by: Priyanka Chopra
10 Replies

5. Shell Programming and Scripting

Jump to next element in a loop

Hi, i want the loop to move to 3rd item, when it encounters 2 while runing for i in 1 2 3 4 5 6 do if then #jump to element 3 else echo $i fi done o/p 1 3 4 5 6 (4 Replies)
Discussion started by: sam05121988
4 Replies

6. Shell Programming and Scripting

Find if XML element has a matching required element

I want to check if every <Part> element has corresponding <Description> in this sample XML. ....<Lot Of XML> <Inv lineNumber="2"> <Item> ... (4 Replies)
Discussion started by: kchinnam
4 Replies

7. Shell Programming and Scripting

Animation Ping on Solaris Like Cisco Ping

Hi, I develop simple animation ping script on Solaris Platform. It is like Cisco ping. Examples and source code are below. bash-3.00$ gokcell 152.155.180.8 30 Sending 30 Ping Packets to 152.155.180.8 !!!!!!!!!!!!!.!!!!!!!!!!!!!!!. % 93.33 success... % 6.66 packet loss...... (1 Reply)
Discussion started by: gokcell
1 Replies

8. UNIX for Dummies Questions & Answers

Last element from cut

Hi, I am looking for a way to get the last element of a cut command ex. $pwd /remote/username/dir1/dir2/dir3 $pwd | cut -f3 -d/ username I need to extract "dir3" (last one) no matter whichever position it is. Thanks, sskb (3 Replies)
Discussion started by: oldtrash
3 Replies
Login or Register to Ask a Question