Bash does not allow if statement inside case statement
bash
Solution
In bash, `if` must precede the `then` part:
if [[ "$PROJN" == "ONE" || "$PROJN" == "two" ]] ; then ESC=hello_linux ; fi
The "postfix" `if` is possible in Perl (and maybe somewhere else, too), but not in bash.
Problem
Can someone help me find out what I am doing wrong on this bash script. I am trying to using if statement inside case statement and bash is complaining syntax error. ``` findinfo() { OPT1=$1 case "$OPT1" in linux) echo "Setting environment" ESC="hello_linux" if [[ "$PROJN" == "ONE" || "$PROJN" == "two" ]] ;; Windows) echo "Setting environment" ESC="hello_windows" if [[ "$PROJN" == "ONE" || "$PROJN" == "two" ]] ;; Android) echo "Setting environment" ESC="hello_android" if [[ "$PROJN" == "ONE" || "$PROJN" == "two" ]] ;; esac } ``` Thanks