Bug 3694

Summary: shell variables exhibit scoping behavior
Product: [Retired] Red Hat Linux Reporter: davidmo
Component: bashAssignee: Cristian Gafton <gafton>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-07-02 21:45:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description davidmo 1999-06-24 03:48:10 UTC
Shell variables seem to exhibit local scoping behavior.
Example:
#!/bin/sh
i=0
cnt=0
while [ i -lt 5 ]
do
   cnt=$cnt+1
   echo $cnt
   i=$i+1
done
echo $cnt

results:
1
2
3
4
0

Comment 1 Jay Turner 1999-06-28 14:01:59 UTC
This issue has been forwarded to a developer for further action.

Comment 2 Cristian Gafton 1999-07-02 21:45:59 UTC
The example provided is invalid (is not a shell script)