bug-bash
[Top][All Lists]
Advanced

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

Re: Bash' code to store string of any characters containing pair of "" a


From: Robert Elz
Subject: Re: Bash' code to store string of any characters containing pair of "" and '' at once
Date: Sun, 22 Dec 2024 09:39:11 +0700

    Date:        Sat, 21 Dec 2024 19:47:31 -0500
    From:        Greg Wooledge <greg@wooledge.org>
    Message-ID:  <20241222004731.GO29532@wooledge.org>

  | Either way, it's not widespread yet, and one shouldn't expect it to be
  | available outside of bash.

If it were only in bash it would never have made it into the standard.
Not sure about current bash, but most other shells have had $'...' for
years now.

for shell in dash fbsh bash mksh ksh93 sh yash bosh 'zsh --emulate sh' 
do      echo =============
        echo $shell
        $shell -c ' printf %s\\n  $'\''Hello\nWorld'\'
done >/tmp/out 2>&1

produces (in /tmp/out)


=============
dash
$Hello\nWorld
=============
fbsh
Hello
World
=============
bash
Hello
World
=============
mksh
Hello
World
=============
ksh93
Hello
World
=============
sh
Hello
World
=============
yash
$Hello\nWorld
=============
bosh
$Hello\nWorld
=============
zsh --emulate sh
Hello
World


fbsh is the FreeBSD shell (circa 2018), sh is the NetBSD shell.

So it looks like dash bosh and yash are yet to add it (yash may
have already, most of these are not up to date).

It really is quite widespread.   To be added to the standard it
needed to be.


kre



reply via email to

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