Re: String replacement drops leading '-e' if replacing char is a space

2023-08-13 Thread Kerin Millar
On Mon, 14 Aug 2023 02:11:27 + pphick via Bug reports for the GNU Bourne Again SHell wrote: > If a string starts with '-e' the replacement operators ${x//,/ } and ${x/, /} > drop the '-e'. > The behaviour seems to be very specific: the string must start with '-e' and > the replacing charact

Re: String replacement drops leading '-e' if replacing char is a space

2023-08-13 Thread Lawrence Velázquez
On Mon, Aug 14, 2023, at 1:27 AM, Eduardo Bustamante wrote: > The echo command is consuming the '-e', as it is a flag. Instead, try > using: > > printf '%s\n' "${x/,/ }" Also note that echo wouldn't have consumed the "-e" had the expansions been quoted properly (as Eduardo did in his printf exa

Re: String replacement drops leading '-e' if replacing char is a space

2023-08-13 Thread Eduardo Bustamante
> > Description: > > If a string starts with '-e' the replacement operators ${x//,/ } and ${x/, > /} drop the '-e'. > The behaviour seems to be very specific: the string must start with '-e' > and the replacing character has to be a space. > > Repeat-By: > > x='-e,b,c' > echo ${x//,/ } > b c > echo

String replacement drops leading '-e' if replacing char is a space

2023-08-13 Thread pphick via Bug reports for the GNU Bourne Again SHell
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-s> uname output: Linux saturn 6.2.6-76060206-generic