mokorana
mokorana

Reputation: 180

How can I load a local config.env in an bash-file when executed remotely?

I have a local config.env which is called in a local local.sh. However, when I use a SSH connection to execute that file on a remote server it's not working anymore.


Example

config.env

HELLO="world"

local.sh

. config.env
printf "Test: %s\n" "$HELLO" # working

When executing ssh -T user@server 'bash -s' < ./local.sh it's not working anymore.

Upvotes: 1

Views: 66

Answers (1)

Philippe
Philippe

Reputation: 26592

You can do :

ssh -T user@server 'bash -s' < <(cat config.env local_as_remote.sh)

and remove . config.env line from local_as_remote.sh

Upvotes: 1

Related Questions