Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Is this possible/easy?



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





Messages sorted by: Reverse Date, Date, Thread, Author