Skip to content
Anton Novojilov edited this page Jan 29, 2020 · 5 revisions

Description

Checks for empty evaluated shell if clauses.

Problematic code

if [[ $1 -ge 1 ]] ; then
%if 0%{?rhel} >= 7
  %{__systemctl} daemon-reload &>/dev/null || :
%endif
fi

Correct code

%if 0%{?rhel} >= 7
if [[ $1 -ge 1 ]] ; then
  %{__systemctl} daemon-reload &>/dev/null || :
fi
%endif

Rationale

If a conditional macro test is unsuccessful, we will get an empty shell if clause.

Clone this wiki locally