Sponsored Content
Full Discussion: IP Ping Sweep
Top Forums Shell Programming and Scripting IP Ping Sweep Post 302902882 by Chubler_XL on Thursday 22nd of May 2014 03:32:35 PM
Old 05-22-2014
Well you could always assign your variable from reply after calling the function.

Or here is a change that adds a 2nd parameter for the variable to store the result.

Code:
function get_three_quad
{
   REPLY=""
   while [ -z "$REPLY" ]
   do
      printf "$1"
      read     
      if ! echo "$REPLY" | grep -qE "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){3}$"
      then
         echo "Illegal input"
         REPLY=""
      fi
    done
    [ $# -gt 1 ] && printf -v "$2" "%s" "$REPLY"
}

get_three_quad "
Enter first three quadrants of router address (must contain three periods)
Example- xx.xxx.xx. : " PT1ADD
echo "You entered: $PT1ADD"

This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ping -t

I need a script that recieves an IP adress and a number of seconds as arguments. and display a massage if the IP replies or not. (8 Replies)
Discussion started by: jaber87
8 Replies

2. UNIX for Dummies Questions & Answers

Ping

Hi , I have one system installed on Linux Red Hat 3.0. I have ip of system 3.156.168.*** and i want to ping some port that is on this IP which command i can do this? sam70 (1 Reply)
Discussion started by: sam70
1 Replies

3. Linux

Not able to ping

Hi All, Need your help one more time. I am trying to ping a linux machine which is not responding to ping. However traceroute can reach the machine and I can log in to it by ssh. I have checked /proc/sys/net/ipv4/icmp_echo_ignore_all it is already set as "0". It is not happening in the... (1 Reply)
Discussion started by: ailnilanjan
1 Replies

4. IP Networking

Can't Ping

I have an old MP-Ras Unix system. I have setup netowkring but am unable to ping any local network pcs or the default gateway. If i use the arp -a command I receive the correct mac address for all connected pcs but I cannot ping anything except the local address. Any help would be appreciative. ... (7 Replies)
Discussion started by: Rutgerncas
7 Replies

5. 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

6. IP Networking

PING

I am unable to ping my remote server.My server is unable to ping the same. both are able to ping the gateway. both the ip's are on same network.i use a proxy tunnel on my remote server.Help if any clues. (6 Replies)
Discussion started by: oslbhavana
6 Replies

7. UNIX for Dummies Questions & Answers

Where is PING ?

SHAME, that's all that I'm felling right now, however I'm not finding PING or either tracert in my box (Solaris 10). 1) Yes my PATH does have /usr/bin /usr/sbin # echo $PATH /opt/csw:/usr/bin:/sbin:/usr/sbin:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin:/opt/csw/gcc2/bin:/opt/csw/bin 2) If I... (1 Reply)
Discussion started by: pxb368@motorola
1 Replies

8. 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

9. OS X (Apple)

A Bash Audio Sweep Generator...

This is a small program as a tester for a basic sweep generator for bandwidth testing of AudioScope.sh. This DEMO is only capable of 4KHz down to about 85Hz and back due to the low bit rate, but it is proof of concept for a much wider variant using a much higher bit rate. The file generated... (4 Replies)
Discussion started by: wisecracker
4 Replies

10. 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
mrinfo(8)						      System Manager's Manual							 mrinfo(8)

NAME
mrinfo - Displays configuration information from a multicast router SYNOPSIS
/usr/sbin/mrinfo [-d debug_level] [-r retry_count] [-t timeout_count] multicast_router OPTIONS
Sets the debug level. When the debug level is greater than 0 (the default), additional debugging messages are printed. Regardless of the debug level, if an error condition occurs, mrinfo writes an error message and terminates. Nonzero debug levels have the following effects: Prints packet warnings to stderr. Prints all level 1 messages and notifications of down networks to stderr. Prints all level 2 messages and notifications of all packet timeouts to stderr. Specifies the number of times to retry a neighbor query. The default is 3 retries. Specifies the number of seconds to wait for a neighbor to reply to a query. The default timeout is 4 seconds. DESCRIPTION
The mrinfo command displays the configuration information from the multicast router multicast_router. The mrinfo command sends the ASK_NEIGHBORS IGMP message to the specified multicast router. If the multicast router responds, the response includes the version number and a list of addresses for their neighboring multicast routers. If the responding router has a recent multi- cast version number, mrinfo requests additional information such as metrics, thresholds, and options from the multicast router. Once the specified multicast router responds, the configuration is displayed to the standard output. RESTRICTIONS
You must be superuser in order to run mrinfo. EXAMPLES
The following example shows the output of the mrinfo command where mbone.phony.dom.net is specified as the multicast router: mrinfo mbone.phony.dom.net 127.148.176.10 (mbone.phony.dom.net) [version 3.3]: 127.148.176.10 -> 0.0.0.0 (?) [1/1/querier] 127.148.176.10 -> 127.0.8.4 (mbone2.phony.dom.net) [1/45/tunnel] 127.148.176.10 -> 105.1.41.9 (momoney.com) [1/32/tunnel/down] 127.148.176.10 -> 143.192.152.119 (mbone.dipu.edu) [1/32/tunnel] For each neighbor of the queried multicast router, the IP address of the queried router is displayed, followed by the IP address and name of the neighbor. In square brackets, the metric (cost of connection) and the threshold (multicast ttl) are displayed. If the queried multi- cast router has a newer version number, the type (tunnel, srcrt) and status (disabled, down) of the connection are displayed. SEE ALSO
Commands: map-mbone(8), mrouted(8), mtrace(8) Networking: mbone.info(7) mrinfo(8)
All times are GMT -4. The time now is 02:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy