I am trying to compare the value stored in string variable with three different possible values and if any of them does not matches then trying to throw error, in a single if statement using the logical operator OR. But everytime I am getting error even though the value stored in the variable is same as one of the possible value. Please find the snippets I tried.
if [[ "$TYPE" != "LOCAL" || "$TYPE" != "REMOTE" || "$TYPE" != "BOTH" ]]; then
echo -e "\n\tINCORRECT OR NULL ARGUMENTS PASSED. PLEASE VERIFY AND CORRECT THE USAGE MENTIONED AS BELOW: \n"
Usage
exit 1
fi
if [[ "$TYPE" != "LOCAL" ]] || [["$TYPE" != "REMOTE" ]] || [["$TYPE" != "BOTH" ]]; then
echo -e "\n\tINCORRECT OR NULL ARGUMENTS PASSED. PLEASE VERIFY AND CORRECT THE USAGE MENTIONED AS BELOW: \n"
Usage
exit 1
fi
Aucun commentaire:
Enregistrer un commentaire