Below is the mwe which reads an input and
compares with character 'a'.
It works fine when invoked as it is.
read -n 1 inp
if [ $inp = 'a' ]
parse error: condition expected: =
This happens because the script you source it from runs with
Sourced scripts are always run with the shell that does the sourcing, regardless of shebang. Your script is written for
bash and is incompatible with
zsh, so it fails.
zsh code is:
read -k 1 inp if [ "$inp" = 'a' ] then echo "Hello" fi