bash problem

Lynn David Newton plug-discuss@lists.plug.phoenix.az.us
Wed, 29 May 2002 23:29:23 -0700


Groop.

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 (!)

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

o On the school system it gives me an error message.
  Regrettably, I don't have the actual message handy,
  but I'm trying to get a student to reproduce it for
  me.

As background: I've been a ksh user since the early
days of ksh, but I'm teaching bash, because that's the
default on most Linux systems. Since I don't know bash
well myself, I have to check everything before I say
it. This time I got caught.

I'm thinking that the arithmetic evaluation code only
fairly recently got cleaned up and ready for prime time
in bash, because I vaguely recall similar problems a
couple of years ago, which drove me away from switching
to bash then.

On the other hand, it's also possible I haven't a clue
what I'm doing.

Would someone whose experience with bash goes back at
least a couple of years tell me if they recollect any
similar problems?

-- 
Lynn David Newton
Phoenix, AZ