Re: Local variable can not unset within shell functions

2024-07-15 Thread Chet Ramey
On 7/11/24 8:40 PM, Robert Elz wrote: Further, if "localness" is considered an attribute of a variable (which isn't how I would implement it, but assuming it is) then surely declare should have an option to set the local attribute, It doesn't need one; using declare in a shell function is suff

Re: Local variable can not unset within shell functions

2024-07-11 Thread Robert Elz
Date:Thu, 11 Jul 2024 16:01:20 -0400 From:Chet Ramey Message-ID: <2739cbbc-d44e-423e-869e-f2884c148...@case.edu> | The bug in bash-4.2 was that [...] | This would have been clearer to see (and more misleading) if the variable | x also had a value at the global

Re: Local variable can not unset within shell functions

2024-07-11 Thread Chet Ramey
On 7/11/24 9:42 AM, Dr. Werner Fink wrote: Hi, I've a report that with later bash the following which works in bash-4.2 x () { local x=y declare -p x echo $x unset x declare -p x echo $x } with linux-40cm:~ # x () { > local x=y > declare -p x > echo $x >

Re: Local variable can not unset within shell functions

2024-07-11 Thread Greg Wooledge
On Thu, Jul 11, 2024 at 15:39:41 -0400, Lawrence Velázquez wrote: > I won't speculate about the issue, but your subject goes too far. > The variable really is unset here: > > % cat /tmp/x.bash > x() { > local x=y > declare -p x > echo "x is ${x

Re: Local variable can not unset within shell functions

2024-07-11 Thread Lawrence Velázquez
On Thu, Jul 11, 2024, at 9:42 AM, Dr. Werner Fink wrote: > I've a report that with later bash the following which works in bash-4.2 > > [...] > > linux-40cm:~ # x () { > > local x=y > > declare -p x > > echo $x > > unset x > > declare -p x > > echo $x > > } > linux-40cm:~ # x

Re: Local variable can not unset within shell functions

2024-07-11 Thread alex xmb sw ratchev
On Thu, Jul 11, 2024, 16:34 alex xmb sw ratchev wrote: > > > On Thu, Jul 11, 2024, 15:42 Dr. Werner Fink wrote: > >> Hi, >> >> I've a report that with later bash the following which works in bash-4.2 >> >> x () { >> local x=y >> declare -p x >> echo $x >> unset x >> declare -p x >>

Re: Local variable can not unset within shell functions

2024-07-11 Thread alex xmb sw ratchev
On Thu, Jul 11, 2024, 15:42 Dr. Werner Fink wrote: > Hi, > > I've a report that with later bash the following which works in bash-4.2 > > x () { > local x=y > declare -p x > echo $x > unset x > declare -p x > echo $x > } > > with > > linux-40cm:~ # x () { > > local x=y > > de

Local variable can not unset within shell functions

2024-07-11 Thread Dr. Werner Fink
Hi, I've a report that with later bash the following which works in bash-4.2 x () { local x=y declare -p x echo $x unset x declare -p x echo $x } with linux-40cm:~ # x () { > local x=y > declare -p x > echo $x > unset x > declare -p x > echo $x > } linux-40cm