Skip to content

Instantly share code, notes, and snippets.

@bamdadd
Last active March 2, 2017 11:35
Show Gist options
  • Save bamdadd/daa90d884454a3c15b8f9427ae57456a to your computer and use it in GitHub Desktop.
Save bamdadd/daa90d884454a3c15b8f9427ae57456a to your computer and use it in GitHub Desktop.
function exit_code {
local OUTPUT="$(docker ps -n 1 --format '{{.Status}}' | tr "\(" " " | tr "\)" " " | awk '{print $2}')"
exit ${OUTPUT:1:1}
}
docker ps ubuntu /bin/true
exit_code
docker ps ubuntu /bin/false
exit_code
@bamdadd
Copy link
Author

bamdadd commented Mar 2, 2017

test with $?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment