Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Delivered-To: mailing list cygwin@cygwin.com Message-Id: <5.2.1.1.2.20030411104309.02dc8e28@pop3.cris.com> X-Sender: rrschulz@pop3.cris.com Date: Fri, 11 Apr 2003 10:46:16 -0700 To: cygwin@cygwin.com From: Randall R Schulz Subject: Re: bash and real arithmetic In-Reply-To: References: <32202909248.20030412000235@ngs.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed At 10:21 2003-04-11, Igor Pechtchanski wrote: >On Sat, 12 Apr 2003, Stepan Yakovenko wrote: > > > HI! > > > > Is it possible to get for loops working > > in double arithmetic in bash ? I've got to run > > a program with a real argument many times, changing it > > every run by some fixed small (<1) number. > > > > Thanx in advance, sorry for my broken English. > >Umm, scale? For example: > > for (( i=0; i < 10; i++ )); do echo 0.$i; done Umm, leading zero suppression? % for (( i=0; i < 100; i++ )); do echo 0.$i; done 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 etc. >You could also try using something like awk for driving the loop: > > awk 'BEGIN {for (i=0; i < 1; i+=0.1) system("echo " i)}' < /dev/null > >Hope this helps, > Igor Randall -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/