zsh-users
 help / color / mirror / code / Atom feed
* Is this possible/easy?
@ 1997-03-03 16:06 Jason Price
  1997-03-03 16:16 ` Timothy Luoma
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jason Price @ 1997-03-03 16:06 UTC (permalink / raw)
  To: zsh-users

I need to generate a script to ping all the IP addresses in a couple
of class C's.  (So we can double check our records, and see which are
in use) Is there a way to generate this easilly?  Even something to
list them all out, and redirect the output would be enough.

Something like

150.150.150.0
150.150.150.1
150.150.150.2
...
150.150.150.255

Thanks;
Jason

-- 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   Jason Price   | The brain is a wonderful organ: it starts working the
Theta Xi, BA 449 | moment you get up, and doesn't stop till you get to class.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is this possible/easy?
  1997-03-03 16:06 Is this possible/easy? Jason Price
@ 1997-03-03 16:16 ` Timothy Luoma
  1997-03-03 16:39   ` Szekeres Istvan
                     ` (2 more replies)
  1997-03-03 16:49 ` Zefram
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 8+ messages in thread
From: Timothy Luoma @ 1997-03-03 16:16 UTC (permalink / raw)
  To: Jason Price; +Cc: zsh-users


well, you could do something like this:

for i in ip1 ip2 ip3
do

ping $i >> ping.out
done

(BTW: say you had 150.121.555.xxx where xxx started at 000 and went to
255, how would you get that to loop?  I thought it would look like this

for i in [000 - 255]
do
	ping 150.121.555.$i
done

but I've tried all sorts of brackets and can't get it to work.  Anyone
know?  I could really use this with some other scripts too

TjL



On Mon, 3 Mar 1997, Jason Price wrote:

> Date: Mon, 3 Mar 1997 11:06:50 -0500 (EST)
> From: Jason Price <gt5076c@cad.gatech.edu>
> To: zsh-users@math.gatech.edu
> Subject: Is this possible/easy?
> Resent-Date: Mon, 3 Mar 1997 11:04:23 -0500 (EST)
> Resent-From: zsh-users@math.gatech.edu
> 
> I need to generate a script to ping all the IP addresses in a couple
> of class C's.  (So we can double check our records, and see which are
> in use) Is there a way to generate this easilly?  Even something to
> list them all out, and redirect the output would be enough.
> 
> Something like
> 
> 150.150.150.0
> 150.150.150.1
> 150.150.150.2
> ...
> 150.150.150.255
> 
> Thanks;
> Jason
> 
> -- 
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>    Jason Price   | The brain is a wonderful organ: it starts working the
> Theta Xi, BA 449 | moment you get up, and doesn't stop till you get to class.
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is this possible/easy?
  1997-03-03 16:16 ` Timothy Luoma
@ 1997-03-03 16:39   ` Szekeres Istvan
  1997-03-03 16:40   ` Clint Adams
       [not found]   ` <luomat@peak.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Szekeres Istvan @ 1997-03-03 16:39 UTC (permalink / raw)
  To: zsh-users


On Mon, 3 Mar 1997, Timothy Luoma wrote:

> for i in [000 - 255]
> do
>       ping 150.121.555.$i
> done
>
> but I've tried all sorts of brackets and can't get it to work.  Anyone
> know?  I could really use this with some other scripts too

what about reading some manual? :)

man zshexpn->

       An expression of the form {n1..n2}, where n1  and  n2  are
       integers,  is  expanded to every number between n1 and n2,
       inclusive.  If either number begins with a zero,  all  the
       resulting  numbers  will  be padded with leading zeroes to
       that minimum width.  If  the  numbers  are  in  decreasing
       order  the  resulting  sequence will also be in decreasing
       order.

so....


for i in {1..254}; do
        ping -c 1 150.121.555.$i
done



Pista




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is this possible/easy?
  1997-03-03 16:16 ` Timothy Luoma
  1997-03-03 16:39   ` Szekeres Istvan
@ 1997-03-03 16:40   ` Clint Adams
       [not found]   ` <luomat@peak.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Clint Adams @ 1997-03-03 16:40 UTC (permalink / raw)
  To: Tim Luoma; +Cc: Jason Price, zsh-users

> for i in [000 - 255]

Try {0..255}


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is this possible/easy?
  1997-03-03 16:06 Is this possible/easy? Jason Price
  1997-03-03 16:16 ` Timothy Luoma
@ 1997-03-03 16:49 ` Zefram
  1997-03-04 12:18 ` gwing
  1997-03-15 12:07 ` Hendrik Visage
  3 siblings, 0 replies; 8+ messages in thread
From: Zefram @ 1997-03-03 16:49 UTC (permalink / raw)
  To: Jason Price; +Cc: zsh-users

Jason Price wrote:
>I need to generate a script to ping all the IP addresses in a couple
>of class C's.  (So we can double check our records, and see which are
>in use) Is there a way to generate this easilly?

for n in {0..255}; do
  ping 150.150.150.$n
done

or, with 3.1, and less dependent on options,

for((n=0; n<256; n++)); do
  ping 150.150.150.$n
done

I actually have a program that performs a related task, that uses both
of the above methods at different points, for maximal efficiency.

-zefram


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is this possible/easy?
       [not found]   ` <luomat@peak.org>
@ 1997-03-03 17:24     ` Bart Schaefer
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 1997-03-03 17:24 UTC (permalink / raw)
  To: Jason Price, zsh-users

I haven't used this for a while, but I happened to have it sitting around
in my FPATH, named pingall ...

for i in $(sed 's/#.*//' < /etc/hosts | awk '{print $2}')
do 
    echo "Trying $i ... " 
    case $HOSTTYPE in
    hp9000*) /etc/ping $i -n 3 ;;
    sun4) /usr/etc/ping $i 56 3 ;;
    *) ping -c 3 $i ;;
    esac 2> /dev/null
    echo '=============================' 
done

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is this possible/easy?
  1997-03-03 16:06 Is this possible/easy? Jason Price
  1997-03-03 16:16 ` Timothy Luoma
  1997-03-03 16:49 ` Zefram
@ 1997-03-04 12:18 ` gwing
  1997-03-15 12:07 ` Hendrik Visage
  3 siblings, 0 replies; 8+ messages in thread
From: gwing @ 1997-03-04 12:18 UTC (permalink / raw)
  To: Jason Price; +Cc: zsh-users

[-- Attachment #1: Type: application/pgp, Size: 1170 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Is this possible/easy?
  1997-03-03 16:06 Is this possible/easy? Jason Price
                   ` (2 preceding siblings ...)
  1997-03-04 12:18 ` gwing
@ 1997-03-15 12:07 ` Hendrik Visage
  3 siblings, 0 replies; 8+ messages in thread
From: Hendrik Visage @ 1997-03-15 12:07 UTC (permalink / raw)
  To: Jason Price; +Cc: zsh-users

Jason Price writes:
 > I need to generate a script to ping all the IP addresses in a couple
 > of class C's.  (So we can double check our records, and see which are
 > in use) Is there a way to generate this easilly?  Even something to
 > list them all out, and redirect the output would be enough.
 > 

There's a program called "fping" that'll do this in a VERY efficient
manner, like reading the list from stdio or a file or command
line. Does these kind of pings and give the answers MUCH faster than
individual pings would. (Sorry if I'm late, but were on vacation, and
this needs a better answer than given via the list)


 > Something like
 > 
 > 150.150.150.0
 > 150.150.150.1
 > 150.150.150.2
 > ...
 > 150.150.150.255
 > 
 > Thanks;
 > Jason
 > 
 > -- 
 > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 >    Jason Price   | The brain is a wonderful organ: it starts working the
 > Theta Xi, BA 449 | moment you get up, and doesn't stop till you get to class.
 > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 > 

Hendrik Visage
HendrikV@disun.denel.co.za


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1997-03-15 12:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-03 16:06 Is this possible/easy? Jason Price
1997-03-03 16:16 ` Timothy Luoma
1997-03-03 16:39   ` Szekeres Istvan
1997-03-03 16:40   ` Clint Adams
     [not found]   ` <luomat@peak.org>
1997-03-03 17:24     ` Bart Schaefer
1997-03-03 16:49 ` Zefram
1997-03-04 12:18 ` gwing
1997-03-15 12:07 ` Hendrik Visage

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).