Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Oct 2025 13:11:07 +0100
From:      Frank Leonhardt <freebsd-doc@fjl.co.uk>
To:        questions@freebsd.org
Subject:   Re: [List] Re: [List] Re: Nice easy sed question
Message-ID:  <38822591-5a17-465d-8ef4-02d70db268c1@fjl.co.uk>
In-Reply-To: <20250925130240640304783@bob.proulx.com>
References:  <c1ba0b3e-2754-4bc7-af0b-b570a7693c7a@fjl.co.uk> <20250911221857100915167@bob.proulx.com> <4c223de1-6ed0-4f56-9b50-6cc1355a9790@fjl.co.uk> <ce6d67d5-83eb-44fb-a8bf-fbc0b00e77b7@qeng-ho.org> <20250912161922207688629@bob.proulx.com> <861po7hao1.fsf@ltc.des.dev> <20250925130240640304783@bob.proulx.com>

index | next in thread | previous in thread | raw e-mail

On 25/09/2025 20:04, Bob Proulx wrote:
> Dag-Erling Smørgrav wrote:
>> Bob Proulx writes:
>>> and implements this ksh-ism so strictly speaking that is not portable
>>> but it does work.
>> Incorrect, dollar-quoted strings are part of POSIX.
>>
>>> This is what POSIX has to say about it.
>>>
>>>      The '$' character is used to introduce parameter expansion, command
>>>      substitution, or arithmetic evaluation. If an unquoted '$' is followed
>>>      by a character that is not one of the following:
>> You are looking in the wrong place.  See XCU 2.2.4:
>>
>> https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_02_04
>>
>>> The result of $'...' such as $'\n' is strictly speaking "unspecified"
>>> behavior by the standard.
>> On the contrary, it is perfectly well-defined.
> Ah!  I always thought that was in the extensions.  I wonder if it was
> at one time and then it was promoted?
>
> In any case it is good to know that it can be counted upon now to
> always be a supported feature of a standard shell.
>
> Thanks for the correction!
>
> Bob

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.

Regards, Frank.




help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38822591-5a17-465d-8ef4-02d70db268c1>