Correct if check to inline the command instead of checking for emptiness of a variable

This commit is contained in:
Jason Ertel
2021-11-23 14:51:06 -05:00
parent 59fc122eec
commit 801d42ed20

View File

@@ -841,8 +841,7 @@ apply_hotfix() {
if [[ "$INSTALLEDVERSION" == "2.3.90" && "$HOTFIXVERSION" == "WAZUH" ]] ; then if [[ "$INSTALLEDVERSION" == "2.3.90" && "$HOTFIXVERSION" == "WAZUH" ]] ; then
FILE="/nsm/wazuh/etc/ossec.conf" FILE="/nsm/wazuh/etc/ossec.conf"
echo "Detecting if ossec.conf needs corrected..." echo "Detecting if ossec.conf needs corrected..."
WAZUHHEADER=$(head -1 $FILE | grep "xml version") if head -1 $FILE | grep "xml version"; then
if [[ ! -z "$WAZUHHEADER" ]]; then
echo "$FILE has an XML header; removing" echo "$FILE has an XML header; removing"
sed -i 1d $FILE sed -i 1d $FILE
so-wazuh-restart so-wazuh-restart