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: Robert Elz
Subject: Re: unset does not remove functions like a[b] unless -f is specified
Date: Sat, 04 Feb 2023 07:01:44 +0700

    Date:        Fri, 3 Feb 2023 11:22:23 -0500
    From:        Chet Ramey <chet.ramey@case.edu>
    Message-ID:  <f1e549d5-59b0-e0af-c02f-fc3c8e50fa70@case.edu>

  | > 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.

If unquoted, the '<' would be an operator (redirection operator)
(or with bash extensions, <( is probably the operator there - doesn't
matter here) - operators cannot be part of a word, that violates the
tokenisation rules.   But if quoted, they're just characters.  In that
case they would form a word.

I'm not sure why bash prohibits quotes around function names, to allow
names containing operators, and white space, as well as the expansion
characters ($ ` * ? and [), and the quote characters themselves.

Is there something about the implementation which would fail if that
rule was removed?

kre




reply via email to

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