Re: Preferred loop structure not working in bash 4.2

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/plain)
Delete this message
Reply to this message
Author: der.hans
Date:  
To: Main PLUG discussion list
Subject: Re: Preferred loop structure not working in bash 4.2
Am 07. Jun, 2016 schwätzte Bryan O'Neal so:

moin moin Bryan,

it works for me using bash 4.3 on debian, so I installed a centos7
container, but it works there as well.

bash-4.2# ( floor=0; ceiling=3; for (( i = ${floor}; i < ${ceiling}; i++
)); do echo $i; done )
0
1
2
bash-4.2#

Diff shopt output from both shells and see if there's an option change
biting you?

ciao,

der.hans

> In centos7, bash 4.2, I am rejected when I try and run my preferred
> iterative loop and I don't know why it no longer likes it
>
> for (( i = ${floor}; i < ${ceiling}; i++ )); do
> things_and_stuff
> done
>
> Anyone know why?
>
> Yes I can still do
> i=${floor}
> while [[ $(( i += 1 )) -le ${ceiling} ]]; do
> things_and_stuff
> done
>
> but it doesn't help me understand why the first construct no longer
> functions.
>


-- 
#  http://www.LuftHans.com/        http://www.PhxLinux.org/
#  ... All true wisdom is found on T-shirts.
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss