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: Fri, 3 Feb 2023 11:22:23 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.0

On 2/2/23 1:47 AM, Martin D Kealey wrote:
...in posix mode, fname must be a valid shell name and may not be the name
of one of the POSIX special builtins.
In default mode, a function name can be any unquoted shell word that does
not contain $.  ...


I'm guessing the intention is that it shouldn't contain any expansions, so
it also shouldn't contain `backticks` or <(command substitutions).

Why not? If you want a shell function name that contains characters that
are special to word expansions, quote them on invocation:

`backtick` ()
{
        echo $FUNCNAME
}

\`backtick\`

They're just nonsensical.


Hmm, I wonder whether <(:) could be a valid function name, if it expands to
something like /dev/fd/63?

Bash doesn't allow that; it treats the < like a $ in this case.

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