On Wednesday, 2021-09-08 at 08:06:27 +02, Paolo Bonzini wrote: > On 07/09/21 13:08, Alexander Bulekov wrote: >> >> -if [ "$GITLAB_CI" != "true" ]; then >> +if [ -z ${GITLAB_CI+x} ]; then > > I would slightly prefer to have "${GITLAB_CI+x}", since "test" in > general doesn't like parameters that go away: > > $ [ = abc ] > bash: [: =: unary operator expected > > What you wrote however works, so it's okay. >
If we are certain that the script is running a bash variant then we really should be using the '[[ ... ]]' variant of test which doesn't have that limitation since it can handle an empty or unset variable correctly. This doesn't appear to be the assumption though. Thanks, Darren.