0

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?

1
  • wrap EOT with single quotes (instead of double quotes) to prevent variable expansion inside the heredoc Commented Apr 16, 2019 at 9:04

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.