help-bash
[Top][All Lists]
Advanced

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

About prepending strings to an array.


From: Peng Yu
Subject: About prepending strings to an array.
Date: Sat, 3 Feb 2024 09:06:24 -0600

Hi,

See below, it looks like & can not be replaced correctly without escaping.

$ set -- 1 2
$ echo ${@/#/&}
1 2
$ echo ${@/#/\&}
&1 &2

I don't remember this was the case in prior versions of bash. But I
don't have access to older versions of bash to double check. Does
anybody know whether bash has always been like this? Or bash has been
changed in the last few years that cause this change of behavior?

-- 
Regards,
Peng



reply via email to

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