Re: How is it explained about the `local` is valid variable

2020-11-25 Thread Chet Ramey
On 11/24/20 8:06 PM, Budi wrote:
> Can we validly write a line
> 
> unset local a b c d e f g h i
> 
> to mean:   local a b c d e f g h i;unset a b c d e f g h i

No.

> if yes, how come local=9 is valid variable 'local' normally ? thanks much

Variables and builtin commands are in different namespaces.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: How is it explained about the `local` is valid variable

2020-11-25 Thread Greg Wooledge
On Wed, Nov 25, 2020 at 08:06:57AM +0700, Budi wrote:
> Can we validly write a line
> 
> unset local a b c d e f g h i
> 
> to mean:   local a b c d e f g h i;unset a b c d e f g h i

No.  And besides, you would want to unset *first*, right?

What are you actually trying to do here?

> if yes, how come local=9 is valid variable 'local' normally ? thanks much

Because it's a valid assignment to a perfectly acceptable variable.

It's the same as:

cd=42
cd /tmp

There's no conflict.  The first one is an assignment to a variable named
cd.  The second one is a cd command.



Re: How is it explained about the `local` is valid variable

2020-11-24 Thread Lawrence Velázquez
> On Nov 24, 2020, at 8:06 PM, Budi  wrote:
> 
> Can we validly write a line
> 
> unset local a b c d e f g h i
> 
> to mean:   local a b c d e f g h i;unset a b c d e f g h i

No. Have you looked at the documentation for "unset"?

vq

P.S. Again, not a bug. Not appropriate for bug-bash.