On Fri, Dec 31, 2021 at 12:49:46PM +0600, NRK wrote:
> What would be a posix replacement for `?=` ? I assume something like:
>
> VAR = $$(if test -n "$$VAR"; then printf "%s" "$$VAR"; else printf
> "fallback"; fi)
>
Now that I think about it, posix shell has parameter expansion that
could be used here for a more compact assignment:
VAR = $${VAR:-fallback}
should also do the trick. I guess it could also be double quoted to
protect against word splitting as well. But I don't think that'd be a
good idea for things like CFLAGS where word splitting is desired.
- NRK