"bad variable name" in bash script started by cron

There is a space between the #! and the /bin/sh. I don't think this is the reported problem but it needs fixing *

I guess that you are using a version of Unix or Linux where /bin/sh is not bash so the export syntax is wrong.

Alter your script to say

PASSPHRASE=foo
export PASSPHRASE

See this answer UNIX export command

* it's not a problem, see comments


They way you export or set your variables are incompatible with your shell. When executing the script - try and use different shell.

sh yourscript.sh 
bash yourscript.sh 
ksh yourscript.sh
csh yourscript.sh
zsh yourscript.sh 

Mostly bash will work for you.

Tags:

Bash

Cron