help-bash
[Top][All Lists]
Advanced

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

Re: any plans for command substitution that preserves trailing newlines?


From: Christoph Anton Mitterer
Subject: Re: any plans for command substitution that preserves trailing newlines?
Date: Tue, 01 Jun 2021 03:34:30 +0200
User-agent: Evolution 3.38.3-1

On Mon, 2021-05-31 at 18:06 -0400, Lawrence Velázquez wrote:
> 
> https://lists.gnu.org/archive/html/bug-bash/2021-01/msg00273.html

I see. Thanks for the pointer.


Problem is that the trailing x solution doesn't seem to work reliably,
see https://unix.stackexchange.com/a/383390/474076, section "About a
trailing x.".

Their idea is basically that adding an x might yield a new character
(e.g. when added to a previously invalid UTF-8 string), and then cannot
be removed afterwards.


But I couldn't reproduce their problems and for me the sentinel value
just worked, though I only tried this in a UTF-8 locale.


Can someone (Chet?) confirm that the solution with adding *any*
character and removing it later on works (i.e. with any locale and any
valid variable content, which is, AFAIU, anything but NUL)?

Or does this work with just some characters like claimed in some posts
on stackoverflow?

Does anyone know whether this is just a feature of bash or works in any
sh compatible shell?



Thanks,
Chris.




reply via email to

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