URL: <https://savannah.gnu.org/bugs/?67358>
Summary: Extra space in parameter expansion with quoted
strings and trailing $.
Group: The GNU Bourne-Again SHell
Submitter: mohos
Submitted: Sat 26 Jul 2025 05:37:05 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: Sat 26 Jul 2025 05:37:05 PM GMT By: mohos <mohos>
Problem description:
When using parameter expansion with a variable containing a space, and then
concatenating it with a string followed by $, an extra leading space appears
before the text.
Bash version:
GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
Steps to reproduce:
export S=" "
echo $S"hello"$
Actual output:
hello$
Expected output:
hello$
Environment:
OS: Ubuntu 22.04 (Linux 5.15)
Locale: en_US.UTF-8
This behavior does not seem documented in POSIX or in the Bash source code.
Please investigate and correct the parameter‑expansion behavior so it
matches the expected output.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?67358>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
