BASH conditional unexpected end of file error with conditional with OR

  Kiến thức lập trình

Getting the following error : syntax error: unexpected end of file

It seems like it’s an issue with my if statement whenever i use the OR (||). Can anyone see anything wrong here?

#!/bin/bash

set -x
# Check status and health
/etc/init.d/opsware-sas health > /dev/null 2>&1
HEALTH_CODE=$?
/etc/init.d/opsware-sas status > /dev/null 2>&1
STATUS_CODE=$?

if [[ $HEALTH_CODE -ne 0 ]] || if [[ $STATUS_CODE -ne 0 ]]; then
    printf "This is the conditional line"
# Code to be executed if condition3 is true
else
    printf "this is the else line"
# Code to be executed if none of the conditions are true
fi

2

LEAVE A COMMENT