---------- Původní e-mail ----------
Od: Hoël Bézier <hoelbezier_at_riseup.net>
Komu: skaware_at_list.skarnet.org
Datum: 24. 3. 2025 19:53:13
Předmět: Re: skawares Failt to build if the CFLAGS are not in the same line
Am Mo, Mär 24, 2025 am 06:38:56 +0000 schrieb Laurent Bercot:
> >>+ IFS=' ' read -r k v ldlibs
> >
> > bash construct ;)
It's not. Quote from the standard:
2.9.1 Simple Commands
A "simple command" is a sequence of optional variable assignments and
redirections, in any sequence, optionally followed by words and
redirections.
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#
tag_19_09_01
> >>+CFLAGS := $CFLAGS ${CFLAGS_POST//'
> >>+'/'\
> >>+'}
> >
> > I am unfamiliar with this, can you please explain it?
> ${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's not. Quote from the standard:
2.6.2 Parameter Expansion
[...]
The simplest form for parameter expansion is:
${parameter}
[...]
In addition, a parameter expansion can be modified by using one of the
following formats.
${parameter:-[word]}
Use Default Values. [...]
${parameter:=[word]}
Assign Default Values. [...]
${parameter:?[word]}
Indicate Error if Null or Unset. [...]
${parameter:+[word]}
Use Alternative Value. [...]
In the parameter expansions shown previously, use of the <colon> in the
format shall result in a test for a parameter that is unset or null;
omission of the <colon> shall result in a test for a parameter that is only
unset. [...]
${#parameter}
String Length. [...]
[...]
${parameter%[word]}
Remove Smallest Suffix Pattern. [...]
${parameter%%[word]}
Remove Largest Suffix Pattern. [...]
${parameter#[word]}
Remove Smallest Prefix Pattern. [...]
${parameter##[word]}
Remove Largest Prefix Pattern. [...]
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#
tag_19_06_02
Received on Mon Mar 24 2025 - 21:23:45 CET