I’m breaking my head, with this. I do not understand why the below IF statement is not working
renameOption="-rs"
if [[ $# -eq 4 ]]; then
if [[ $renameOption != "-rs" ]] || [[ $renameOption != "-rb" ]]; then
echo -e "\tArgument three needs to be '-rs' or '-rb'"
echo -e "\tNow exiting script"
exit
fi
flag=1
echo "Good to go"
fi
I know the syntax is right, but what I noticed is that the system does not recognize the OR || expression in the second IF. When using a single expression, it works fine, But I need to compare with two expressions, therefore the OR ||.
I’m running OSX Lion 10.7.4
Does it even make sense?
$renameOptionis always not equal to either of those two. You probably wanted&&.