Zend certified PHP/Magento developer

Run shell script on local machine with SSH using local environment variable

I currently compute some environment variable on my local machine $FOO. Now, I have an SSH script which consists of a few commands, some of which use the environment variable $FOO, which is only set on my local machine.

I want to run those commands on the remote machine but I want to substitute the local version of $FOO so that when the SSH script runs on my remote machine it will use the local, computed value of $FOO. I need to do this because how the commands run on the remote machine depends on the local value of $FOO that I have computed.

I know that you can do ssh user@remote < script.sh to run the local shell script on the remote machine but I am unsure how to do that process but with my local $FOO environment variable as I mentioned above. I do not want to have to configure SSH on either the local or remote machines so SendEnv is not an option for me.

What is the best way to run those commands that I have in my shell script with the local environment variable $FOO?