bug-bash
[Top][All Lists]
Advanced

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

Re: bug: illegal function name?


From: Chet Ramey
Subject: Re: bug: illegal function name?
Date: Sun, 20 Jan 2019 16:02:51 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.3

On 1/20/19 1:46 PM, Andrey Butirsky wrote:
> I'm not quite understand what exactly is "intentional".
> The problem is inconsistent behavior of unset '-f' flag for "normal" and
> "not-normal" function names (I'm not considering conflicting with
> variable names case).

You should not ignore the variable names case. The behavior of unset
without arguments is to check for a variable first, then optionally
check for a function name. The variable name check enforces the
restrictions on valid characters that may appear in variable names. The
only guaranteed way to make a POSIX shell unset a function name is to
use `unset -f'.

"If neither -f nor -v is specified, name refers to a variable; if a
variable by that name does not exist, it is unspecified whether a function
by that name, if any, shall be unset."

Where is the inconsistent behavior for `unset -f'? It works whatever
the name of the function is when in default mode, and obeys the POSIX
restrictions when in posix mode.

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



reply via email to

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