doc/{bash.1,bashref.texi}
- BASH_REMATCH: add caveat about making it a local variable
+
+ 6/6
+ ---
+print_cmd.c
+ - print_redirection: if the redirectee for r_duplicating_output_word
+ (r_duplicating_input_word) is 1 (0), don't print it; only print a
+ non-default file descriptor number
+ - print_redirection_list: remove the code that tries to temporarily
+ translate a >&word redirection to >&word now that we won't print a
+ non-default file descriptor number. Fixes issue with `declare -f' and
+ function export reported by Namikaze Minato <lloydsensei@gmail.com>
/* print_command -- A way to make readable commands from a command tree. */
-/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
else
hdtail = heredocs = newredir;
}
+#if 0
+ /* Remove this heuristic now that the command printing code doesn't
+ unconditionally put in the redirector file descriptor. */
else if (redirects->instruction == r_duplicating_output_word && (redirects->flags & REDIR_VARASSIGN) == 0 && redirects->redirector.dest == 1)
{
/* Temporarily translate it as the execution code does. */
print_redirection (redirects);
redirects->instruction = r_duplicating_output_word;
}
+#endif
else
print_redirection (redirects);
case r_duplicating_input_word:
if (redirect->rflags & REDIR_VARASSIGN)
cprintf ("{%s}<&%s", redir_word->word, redirectee->word);
+ else if (redirector == 0)
+ cprintf ("<&%s", redirectee->word);
else
cprintf ("%d<&%s", redirector, redirectee->word);
break;
case r_duplicating_output_word:
if (redirect->rflags & REDIR_VARASSIGN)
cprintf ("{%s}>&%s", redir_word->word, redirectee->word);
+ else if (redirector == 1)
+ cprintf (">&%s", redirectee->word);
else
cprintf ("%d>&%s", redirector, redirectee->word);
break;