Created
April 16, 2010 19:22
-
-
Save thewoolleyman/368828 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
run() { | |
ssh -i $keypair ubuntu@$host $* | |
} | |
run_ensuring_success() { | |
output=$(run $*) | |
if [[ $? != 0 ]] ; then | |
echo "AMIBUILDER: Command failed: $*" | |
terminate_instance | |
exit 1 | |
fi | |
$output # <-- How to I make run_ensuring_success() return the command output like run() does? | |
} | |
output1=$(run "hostname") # -> domU-12-31-38-06-C0-71 | |
output2=$(run_ensuring_success "hostname") # -bash: domU-12-31-38-06-C0-71: command not found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment