What does the ending +x
mean in the BUILD_ENV_IMAGE+x
of below script?
if [[ -z "${BUILD_ENV_IMAGE+x}" ]]; then
BUILD_ENV_IMAGE="${CI_CONTAINERS_REGISTRY}/build-env:${CI_CONTAINERS_BASE_TAG}-gcc11"
fi
I am not sure if it is bash or sh specific. So I add both tags.
ADD 1 -- 2:10 PM 1/14/2023
A sample
# var is set to null
var=
# check if var is unset or null
echo ${var:+literal_out_put} abc
# only check if var is unset
echo ${var+literal_out_put}
if [[ -z ${var+literal_out_put} ]];
then
echo var is unset;
else
echo var = $var
fi
Output:
abc
literal_out_put
var =
Table from https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02