Click here to get rid of any annoying frames |
masonip@attachmate.co_ (Mason Ip) writes:
> >I want to setup a retry loop and execute a bunch of stuff 5 times before
> >failing,
>
> While other posters have given you the normal way, here is an
> alternative solution.
>
> Find jot.c in the web and compile it.
> Running "jot 10 1" will produce 10 numbers starting from 1.
> So, you script can be like this.
>
> #!/bin/sh
> for i in `jot 10 1`
> do
> echo $i
> done
> 1
> 2
> 3
> [...]
> 10
>
> It is an elegant way to create a loop (big or small) without
> doing the increment yourself.
For those of you who are not using FreeBSD, and not staying at the forefront of your OS release, you may find that the FreeBSD-dependent jot can not be compiled under your OS. That's true for me.
But don't give up. Jot is a highly recommended tool. I use it quite a lot. I get rid of all FreeBSD dependent stuff so it can be compiled with any ANSI compatible c compiler. The make file was changed aslo. I've put it in my xpt project web for your convenient.
The binary file that comes with the package is compiled under RH6.2 with gcc: egcs-2.91.66.
http://xpt.sourceforge.net/tools/crossplatform/
Enjoy it.
Tong