bug-bash
[Top][All Lists]
Advanced

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

Re: 5.3: Why is <(cmd) allowed in func names of func defs?


From: Koichi Murase
Subject: Re: 5.3: Why is <(cmd) allowed in func names of func defs?
Date: Wed, 4 Jun 2025 09:21:27 +0900

2025年6月4日(水) 0:57 Koichi Murase <myoga.murase@gmail.com>:
> [...]. If it was
> implemented after Ref. [1], « '<(echo hello)' () { echo hello; } »
> should have been supported but not « <(echo hello) () { echo hello;
> }.».

I realized that « '<(echo hello)' () { ...; } » is actually supported
in Bash 5.3, but the behavior is not what was expected by Ref. [1]
(and it's not what I expect either). It creates a function named «
'<(echo hello)' » instead of a function named « <(echo hello) ».

  $ bash-devel -c $'\'<(echo hello)\' () { echo yes; }; "<(echo hello)"'
  bash-devel: line 1: <(echo hello): command not found
  $ bash-devel -c $'\'<(echo hello)\' () { echo yes; }; "\'<(echo hello)\'"'
  yes

I expect « '<(echo hello)' () { ...; } » creates a function named «
<(echo hello) ».

>   $ bash-devel -c '<(echo hello) () { echo hello; }; declare -F'
>  declare -f <(echo hello)

By the way, I think the output of `declare -F' should be quoted when
necessary because the argument of `declare' is a normal context where
shell expansions happen.

--
Koichi



reply via email to

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