Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Feb 1999 13:37:23 +0000
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        root@isis.dynip.com
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Help About Shell Script
Message-ID:  <19990207133723.B71725@scientia.demon.co.uk>
In-Reply-To: <199902071255.PAA36498@isis.dynip.com>
References:  <199902071255.PAA36498@isis.dynip.com>

next in thread | previous in thread | raw e-mail | index | archive | help
root@isis.dynip.com wrote:

> in BASIC language terms, but in sh script ?
> 
> for i = 0 to 1000
> 	for j = 0 to 1000
> 		do something using ( current i , current j )
> 
> 		increment j
>  	next
>  	increment i
> next

i=0
while [ $i -le 1000 ]; do
	j=0
	while [ $j -le 1000 ]; do
		## do your stuff here with $i and $j

		j=$(($j+1))
	done
	i=$(($i+1))
done

-- 
Ben Smithurst
ben@scientia.demon.co.uk

send a blank message to ben+pgp@scientia.demon.co.uk for PGP key

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990207133723.B71725>