Skip to content

Instantly share code, notes, and snippets.

@4O4
Last active February 26, 2018 09:05
Show Gist options
  • Select an option

  • Save 4O4/b4e71ab04625df70979ce6d3a7f5801f to your computer and use it in GitHub Desktop.

Select an option

Save 4O4/b4e71ab04625df70979ce6d3a7f5801f to your computer and use it in GitHub Desktop.
Get value of environment variable from remote server. Wrapper around remote_exec gist (https://gist.github.com/4O4/18b69f34001439a2b01532c1ae377aa2)
#!/usr/bin/env bash
# Get remote_exec.sh from another gist: https://gist.github.com/4O4/18b69f34001439a2b01532c1ae377aa2
source remote_exec.sh
get_remote_var() {
remote_exec ${1} "echo -n \${${2}}"
}
# Usage example
REMOTE_JAVA_TOP=$(get_remote_var user@example.com JAVA_TOP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment