Re: bug attached

2023-08-31 Thread queency3 jones
yes ! the local declaration solved my problem. tnx very much . On Thu, Aug 31, 2023 at 10:51 PM Andreas Kusalananda Kähäri < andreas.kah...@abc.se> wrote: > On Thu, Aug 31, 2023 at 10:38:55PM +0300, queency3 jones wrote: > > i don't think that main is significant when it declared in "Bash" but >

Re: bug attached

2023-08-31 Thread Andreas Kusalananda Kähäri
On Thu, Aug 31, 2023 at 10:38:55PM +0300, queency3 jones wrote: > i don't think that main is significant when it declared in "Bash" but even > though, > if you change the function main , to function ain the $aa should be local > , but it ain't !! Function names being "main" or "ain" is irrelevant

Re: bug attached

2023-08-31 Thread Greg Wooledge
On Thu, Aug 31, 2023 at 10:38:55PM +0300, queency3 jones wrote: > > > function sub { aa=8;return_value=$aa; } > > > function sub { aa=8; } > > > > > > function main { aa=3;sub;aa=$(($aa+1));printf "$aa\n"; } > i don't think that main is significant when it declared in "Bash" but even > though, > i

Re: bug attached

2023-08-31 Thread Chet Ramey
On 8/31/23 3:38 PM, queency3 jones wrote: i don't think that main is significant when it declared in "Bash" but even though, if you change the function main , to function ain the $aa should be local , but it ain't !! Why? Are you saying that all variable assignments in functions should act as

Re: bug attached

2023-08-31 Thread queency3 jones
i don't think that main is significant when it declared in "Bash" but even though, if you change the function main , to function ain the $aa should be local , but it ain't !! On Wed, Aug 30, 2023 at 5:59 PM Andreas Kusalananda Kähäri < andreas.kah...@abc.se> wrote: > On Wed, Aug 30, 2023 at 03:

Re: bug attached

2023-08-30 Thread Andreas Kusalananda Kähäri
On Wed, Aug 30, 2023 at 03:40:21PM +0300, queency3 jones wrote: > > From: queen...@gmail.com > To: bug-bash@gnu.org > Subject: 2 same var name in different function causing mix > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: g

Re: bug attached

2023-08-30 Thread Chet Ramey
On 8/30/23 8:40 AM, queency3 jones wrote: > Bash Version: 5.0 > Patch Level: 3 > Release Status: release > > Description: > > function sub { aa=8;return_value=$aa; } > function sub { aa=8; } > > function main { aa=3;sub;aa=$(($aa+1));printf "$aa\n"; } > > > calling main will print 9 instead of 4