bug-bash
[Top][All Lists]
Advanced

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

Re: unset does not remove functions like a[b] unless -f is specified


From: Chet Ramey
Subject: Re: unset does not remove functions like a[b] unless -f is specified
Date: Sat, 4 Feb 2023 15:04:40 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 2/4/23 4:23 AM, Koichi Murase wrote:

As far as I test, there are four implementations that allow defining
functions with slashes: Bash and Zsh allow executing the functions
(even in their POSIX modes), and mksh and Yash don't allow executing
them by default.

Yash doesn't allow declaring functions with slashes in their names.


If a non-POSIX (ksh-like) shell script defines any functions with
names that have a slash and conflict with the real executable files
the script wants to run, the script should be responsible for any
problems caused by it. If the script wants to run the executable, the
script obviously shouldn't define the function with the same name as
the executable path.

This breaks down in the face of function libraries like the one you've
built. Your statement is correct if the script knows all the functions
it has defined at the time it goes to execute the file in question.

--
``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]