0

I have a shell script which ssh to a server.

ssh -t user@x.x.x.x << "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?

Karias Bolster
  • 955
  • 3
  • 17
  • 31
  • wrap `EOT` with single quotes (instead of double quotes) to prevent variable expansion inside the heredoc – Anubis Apr 16 '19 at 09:04

1 Answers1

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.

R. Du
  • 544
  • 4
  • 16