On Fri, 3 Jun 2022 at 23:24, Alexey <aluka...@alukardd.org> wrote: > > As I can see, problem exist only if we quote "$foo". Without quotes > everything looks fine. > > > As a special case, if n is omitted, and word does not expand to one or > > more digits or -, the standard output and standard error are redirected > > as described previously. > I guess this man line is related to this case, and explains why both > stdin and stdout redirects occurs together (&>).
Hello Alexey. Thank you for the workaround of removing the quotes. And sorry for my being late to answer. Please note however, that: 1 - n not being omited (and quotes being used) still produce the same bug: $ f(){ printf test\\n 1>&"$foo"; }; declare -f f f () { printf test\\n &> "$foo" } 2 - Even if I somehow did misunderstand the manual, the bug really existing is incontestable as 'declare -f' does not display the function code being executed. $ foo=1 test test $ # As you can see, it did not create a file named "1" but behaved just as defined, like `printf test\\n 1>&1` $ eval "$(declare -f f)" $ foo=1 f $ cat 1 test $ # reading the code from 'declare -f' changed the function! @everyone, please let me know if I need to do something else to actually report the bug or if this thread is enough. Regards, Minato