[Bug 854679] New: bash does not properly handle value assignment in scripts if variable is assigned new value in a while loop
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=854679 https://bugzilla.novell.com/show_bug.cgi?id=854679#c0 Summary: bash does not properly handle value assignment in scripts if variable is assigned new value in a while loop Classification: openSUSE Product: openSUSE 12.3 Version: Final Platform: x86-64 OS/Version: openSUSE 12.3 Status: NEW Severity: Major Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: rens.groenewegen@xs4all.nl QAContact: qa-bugs@suse.de Found By: --- Blocker: --- Created an attachment (id=571071) --> (http://bugzilla.novell.com/attachment.cgi?id=571071) two scripts showing the difference between bash and ksh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:21.0) Gecko/20100101 Firefox/21.0 if a export someval=0 is done, and someval is assigned a new value in a while [ ] .... do someval=10 done the value of someval will still be 0 instead of 10. ksh does assign a value 10 to someval and retains it after exiting the while loop. see sample scripts. Reproducible: Always Steps to Reproduce: 1.run scripts bashbug and kshnobug 2.notice difference 3.scratch behind ear (left or right, at your discretion) Actual Results: value should have been 10, is still zero (bashbug script) Expected Results: value should have been 10. output of the two scripts: ____________ bashbug ______________ cval before while is now 0 entering while cval = 1 file = 7z cval = 2 file = 7za cval = 3 file = Backarrow2BackSpace cval = 4 file = Backarrow2Delete cval = 5 file = ChangeSymlinks cval = 6 file = Convert cval = 7 file = LinuxVNC cval = 8 file = Mail cval = 9 file = PTBatcher cval = 10 file = PTBatcherGUI after while: cval = 0 ____________ kshnobug ______________ cval before while is now 0 entering while cval = 1 file = 7z cval = 2 file = 7za cval = 3 file = Backarrow2BackSpace cval = 4 file = Backarrow2Delete cval = 5 file = ChangeSymlinks cval = 6 file = Convert cval = 7 file = LinuxVNC cval = 8 file = Mail cval = 9 file = PTBatcher cval = 10 file = PTBatcherGUI after while: cval = 10 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=854679
https://bugzilla.novell.com/show_bug.cgi?id=854679#c1
--- Comment #1 from rens groenewegen
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=854679
https://bugzilla.novell.com/show_bug.cgi?id=854679#c
zhang jiajun
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=854679
https://bugzilla.novell.com/show_bug.cgi?id=854679#c2
Dr. Werner Fink
![](https://seccdn.libravatar.org/avatar/3035b38ff33cf86f480bb169b8500b80.jpg?s=120&d=mm&r=g)
https://bugzilla.novell.com/show_bug.cgi?id=854679
https://bugzilla.novell.com/show_bug.cgi?id=854679#c3
--- Comment #3 from rens groenewegen
participants (1)
-
bugzilla_noreply@novell.com