URL: <https://savannah.gnu.org/bugs/?67429>
Summary: Possible Inconsistent Redirection Behavior with Variable Expansion and Trailing Spaces Group: The GNU Bourne-Again SHell Submitter: mohos Submitted: Thu 14 Aug 2025 06:14:59 PM GMT Category: None Severity: 3 - Normal Item Group: None Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Thu 14 Aug 2025 06:14:59 PM GMT By: mohos <mohos> Description: When performing output redirection with a variable containing a space, Bash gives an “ambiguous redirect” error in some cases but not in others, depending on where the space appears in the resulting filename. Steps to Reproduce: $ export S=" " $ >file$S% bash: file$S%: ambiguous redirect $ >file$S$ $ ls file$ Observed Behavior: In the first case (>file$S%), Bash reports ambiguous redirect. In the second case (>file$S$), Bash creates a file whose name ends with a dollar sign, despite $S still expanding to a space. Expected Behavior: It seems reasonable to expect that both cases should either: Produce an ambiguous redirect error, or Be accepted consistently. Environment: Bash version: bash --version → (5.2.37(1)-release x86_64-pc-linux-gnu) OS: (Ubuntu 20.04.6 LTS) _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?67429> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature