Am Mo, Mär 24, 2025 am 08:09:58 +0000 schrieb Laurent Bercot:
>
> > It does not. You forgot to export CFLAGS.
>
> Gosh I'm an idiot. Thanks.
>
>
> > ${VAR//pattern/replacement} replaces every pattern in VAR by
>replacement. Here it adds a backslash before every newline.
> >
> > If I trust https://steinbaugh.com/posts/posix.html#replacement, this
>is POSIX-compliant.
>
> It does not appear as a listed construct in
>https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#t=
>ag_19_06_02
>which is the official reference, so I'm not going to use it.
>
> In any case, adding a backslash before very newline is the exact kind
>of cursed half-baked quoting that causes as many problems as it solves.
>(what if there's already a backslash before the newline? etc.)
>
> If the problem is caused by IFS, then it should be solved by IFS.
>Setting it back to the previous value should be all the fix that's
>needed, shouldn't it?
I’m not sure I get why you changed its value in the first place. If I’m not
mistaken, its default value is " \t\n", expanding "$*" uses the first character
of IFS for separating values. So this should be good for your use case, unless
I’ve missed something, which is very possible. :)
Hoël
Received on Mon Mar 24 2025 - 21:30:32 CET