in bash if already tests exit status is 0 or not

The other way works too, but it seems pointless to go through extra steps when the if command already does exactly this
This commit is contained in:
krzee
2021-08-11 15:11:43 -07:00
committed by GitHub
parent 4b75a6679b
commit 93d12d2143

View File

@@ -47,10 +47,7 @@ done
CONFIG_CODE=$(curl ${auth} -s -o /dev/null -w "%{http_code}" -XGET $el_url/.wazuh/_doc/1513629884013)
grep -q 1513629884013 $kibana_config_file
_config_exists=$?
if [[ "x$CONFIG_CODE" != "x200" && $_config_exists -ne 0 ]]; then
if [[ "x$CONFIG_CODE" != "x200" ]] && ! grep -q 1513629884013 $kibana_config_file ; then
cat << EOF >> $kibana_config_file
hosts:
- 1513629884013: