bug-bash
[Top][All Lists]
Advanced

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

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


From: Lawrence Velázquez
Subject: Re: String replacement drops leading '-e' if replacing char is a space
Date: Mon, 14 Aug 2023 01:35:48 -0400
User-agent: Cyrus-JMAP/3.9.0-alpha0-624-g7714e4406d-fm-20230801.001-g7714e440

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 example):

        bash-5.2$ x='-e,b,c'
        bash-5.2$ echo "${x//,/ }"
        -e b c
        bash-5.2$ echo "${x/,/ }"
        -e b,c


-- 
vq



reply via email to

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