How to override environment variables through the Build Trigger API

I m trying to override a variable from ENV VARS using script action / step

#!/bin/bash
set -ex
if [ ! -z “$API_BUILD_NO” ] ; then
echo “Env Vars”
envman add --key BUILD_NO --value “$API_BUILD_NO”
fi

BUILD_NO is defined in ENV VARS and I m trying to use BUILD_NO in next step after this , here is the request to API

{“hook_info”: {“type”: “bitrise”},“build_params”: {“branch”: “master”},“environments”:[
{“mapped_to”:“API_BUILD_NO”,“value”:“10”,“is_expand”:false}]}

But in the response I see following in the script step

  • ‘[’ ‘!’ -z ‘’ ‘]’

I am not a script expert can you please suggest whats wrong with this ?