bash problem

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: der.hans
Date:  
Subject: bash problem
Am 29. May, 2002 schwätzte Lynn David Newton so:

> I'm teaching Unix/Linux at UACT. In tonight's class I
> came across a strange bash problem in connection with
> arithmetic evaluation. I'm wondering if there is a
> version problem.
>
> o The system students have for use is running Red Hat
> 6.2 (!)


Check that you're using bash2 rather than bash 1.x.

> o I'm trying to demonstrate the superiority in
> performance using arithmetic evaluation over the old
> technique of using eval to increment variables.
>
> o The following command line works fine in ksh and also
> in bash 2.05-8
>
> aa=1; time while ((aa <= 1000)); do ((aa += 1)); done


BTW, that's an excellent demo. Almost instantanteous for the arith eval vs.
almost 6 seconds using expr. 15 sec on my p133, but still almost
instantaneous for the arith eval version.

ciao,

der.hans
--
# https://www.LuftHans.com/
# The Internet is the front line of the battle
# to protect our freedom. -- Nathaniel Borenstein