I have a shell script that should accept multiple arguments.
It can either accept the argument "update" or "create". If no argument is passed, the user should get an error. However, when building my if/elif condition I'm getting the error:
syntax error in conditional expression: unexpected token `;'   The code:
firstParam=$1 echo $firstParam //update/create/{empty}  if [[ "$firstParam" == "" ]]; then     printf "${RED}Use this script as \"tzfrs update/new [projectName]\"${NC} \n"     exit 1 elif [[ "$firstParam" == "update"]]; then   printf "update"   exit 1 fi   If I have the script like this
if [[ "$firstParam" == "" ]]; then     printf "${RED}Use this script as \"tzfrs update/new [projectName]\"${NC} \n"     exit 1 fi   The error handling works, and I'm seeing the following message
Use this script as "tzfrs update/new [projectName]"
However, when adding the elif condition I'm getting the above error. Anyone any idea?
elif [[ "$firstParam" == "update"]]; then    should be
elif [[ "$firstParam" == "update" ]]; then   with a space between "update" and ]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With