1

I am getting the error "Conditional binary operator expected in the following script.

if [[ $LOCALE -eq 'US' ]]; then
RWLOGGROUPNAME=/US/Live/access-log
DPXLOGGROUPNAME=/US/Live/access-log
END_POINT=https://us.ginger.com
fi

if [[ $LOCALE -eq 'DE' || $LOCALE -eq 'FR' || $LOCALE -eq 'IT' ||  $LOCALE -eq 'UK' ]]; then
RWLOGGROUPNAME=$LOCALE/Live/access-log
DPXLOGGROUPNAME=$LOCALE/Prod/access_log
END_POINT=https://eu.ginger.com
fi

Can some one tell me what is going wrong here. I am taking locale from command line and have put it in quotes as it's a string.The first if works fine but the next one does not.

1 Answer 1

1

-eq is used for integer comparison only, moreover you are using eq at few places instead of -eq.

Make it:

if [ "$LOCALE" = "DE" -o "$LOCALE" = "FR" -o "$LOCALE" = "IT" -o "$LOCALE" = "UK" ]; then
Sign up to request clarification or add additional context in comments.

2 Comments

I have it in code . It somehow got removed while posting the issue here :)
ok check updated answer now. You cannot use -eq for string comparison.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.