SSH: Use Remote Bash / KSH source Command Set Variable Locally From a Remote Server
You can use the remote source command with the ssh command to set a variable locally from a remote server. Here’s an example in bash: VAR=$(ssh user@remote-server “source ~/.bashrc; echo \$VAR”) In this example, the ssh command connects to the remote server as user, sources the ~/.bashrc file, and then echoes the value of the … Read more