Re: Nice easy sed question

From: Frank Leonhardt <freebsd-doc_at_fjl.co.uk>
Date: Sun, 05 Oct 2025 10:58:34 UTC
On 04/10/2025 21:33, Dag-Erling Smørgrav wrote:
> Frank Leonhardt<freebsd-doc@fjl.co.uk>  writes:
>> Bob Proulx<bob@proulx.com>  writes:
>>> Dag-Erling Smørgrav<des@FreeBSD.org>  writes:
>>>> Incorrect, dollar-quoted strings are part of POSIX.
>>> Ah!  I always thought that was in the extensions.  I wonder if it was
>>> at one time and then it was promoted?  [...]
>> I second Bob! You've linked to a very useful page there. I note it's
>> 2024, so I'd be a bit careful of using all of it but at least I can
>> point to it and say "It's POSIX so it's not my fault" :-) It says
>> ${#parameter} is definitely POSIX, which is another thing I've avoided
>> until now.
> Parameter length existed in Issue 6 (2001), and probably much earlier,
> but I didn't bother going further back in time.  Dollar-single-quotes
> were added in Issue 8 (2024) but the decision to do so was made around
> 2010 or 2011 (https://www.austingroupbugs.net/view.php?id=249) and
> support for them was added to FreeBSD in 2011 (svn r221513 / git
> a62ab0274a1a).  They are, perhaps unsurprisingly, a Kornism.
>
> DES

That would figure. I'm still running 8.2 on some systems and $'' doesn't work there.

--------------------

# echo $'One\ntwo'

$One\ntwo

--------------------

Not actually what I was expecting! I'll stick with...

echo 'One
two'

...for a few years yet. Anything that wasn't in SVR2 is a non-standard 
extension to me! A surprising number of extensions to the Bourne Shell 
were already present by then, from what I remember; and on FreeBSD we're 
basically running that the Almquist shell which is a reimplementation of 
the System V shell if I understand it correctly?!?

Regards, Frank.