Karias Bolster
Karias Bolster

Reputation: 1035

How to read target environment variables in shell script ssh

I have a shell script which ssh to a server.

ssh -t [email protected] << "EOT"
echo $ENVIRONMENT_VARIABLE
set +e
EOT

The $ENVIRONMENT_VARIABLE is already set in the server. However in the script it cannot read its value. How can I make it so that in the script it can read its value?

Upvotes: 0

Views: 276

Answers (1)

R. Du
R. Du

Reputation: 633

It looks like you don't have your environment fully set when in the SSH session. It depends on the type of session opened (interactive, login shell, ...). It also depends on your Linux and the shell you are using. You can check this topic on the subject.

Upvotes: 1

Related Questions