Preferred loop structure not working in bash 4.2

der.hans PLUGd at LuftHans.com
Tue Jun 7 12:37:42 MST 2016


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.


More information about the PLUG-discuss mailing list