I often execute commands like this:
ssh username@hostname 'bash -s' < bashScriptToExecuteRemotely
I now have a case where bashScriptToExecuteRemotely
is expecting certain environment variables to be set. In my case, let's say they are FOO=14 and BAR=giraffe.
How may I cause the bash shell that's launched on the remote host to have these environment variables set before executing bashScriptToExecuteRemotely
?
Best Answer
Use the
env
command: