Last active
August 29, 2015 14:07
-
-
Save statianzo/8ee6aaaba490947acaa3 to your computer and use it in GitHub Desktop.
Run a command in the same environment as a cloud66 stack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
usage(){ | |
echo "Usage: cxenv stack environment [command]" | |
exit 1 | |
} | |
[ $# -lt 3 ] && usage | |
stack=$1 | |
shift 1 | |
environment=$1 | |
shift 1 | |
vars=$(cx env-vars -s $stack -e $environment | sed 1d | awk -F ' ' '{print $1 "=" "\"" $2 "\""}' | tr '\n' ' ') | |
env "${vars}" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment