bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug: illegal function name?


From: Andrey Butirsky
Subject: Re: bug: illegal function name?
Date: Mon, 21 Jan 2019 17:12:18 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Thunderbird/65.0

On 21.01.2019 05:26, Robert Elz wrote:
> I think his point is that if unset "unset f" (no flags) works to unset 
> function f, if f is not a (set) variable, then it should work every time
> "f" is not a set variable, not only the times when the word "f" happens
> to be of the correct syntax to be a variable name, but happens not
> to be.
>
> I think that is a good point.
>
> In the NetBSD sh we avoid that issue completely, the only way to
> unset a function is with "unset -f", a simple "unset f" only ever
> unsets variables.

Thanks Robert, this was my point indeed.

Thinking about it again, I see no point to behave differently depending
on the name being POSIX or not.
So, for `unset' without flags, I think we should just either not trying
to unset functions at all, or try it if no variable with such name
exists, always.
The latter is probably fine since it will not break existing scripts.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]