bug-bash
[Top][All Lists]
Advanced

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

Re: [PATCH] Add shopts for trailing newlines in command substitution and


From: Oğuz
Subject: Re: [PATCH] Add shopts for trailing newlines in command substitution and here strings
Date: Thu, 28 Aug 2025 12:24:15 +0300

On Thursday, August 28, 2025, Kevin Pulo <kevin.pulo@mongodb.com> wrote:
>
> I have a lot of control


Good. It's easier to change the input than change Bash and wait for another
release (which might take more than a year).


> I could instead force some special way of representing a blank line, eg.
> "<blank>", but then code which processes each word separately will need to
> be
> more complex than the current:
>
>     for word in $line; do
>         ...
>     done
>
> unless the "special blank line" is "one or more spaces/tabs".  But even
> then,
> care needs to be taken to ensure that a space gets output instead of a pure
> blank line.
>

It's hard to suggest a workaround without seeing the full picture but this
seems like your best bet. This or storing the input in a temporary file and
consuming it line by line instead of slurping it all at once.


-- 
Oğuz


reply via email to

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