projects
/
cmccabe-bin
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
444b95a
)
dssh: add the ability to execute arbitrary commands
author
Colin P. Mccabe
<colin@cmccabe.xyz>
Tue, 29 Nov 2016 22:53:29 +0000 (14:53 -0800)
committer
Colin P. Mccabe
<colin@cmccabe.xyz>
Tue, 29 Nov 2016 22:53:29 +0000 (14:53 -0800)
dssh
patch
|
blob
|
history
diff --git
a/dssh
b/dssh
index
a00ca4d
..
710fdac
100755
(executable)
--- a/
dssh
+++ b/
dssh
@@
-35,6
+35,12
@@
while getopts "hi:n:" flag; do
exit 1;;
esac
done
+shift $(expr $OPTIND - 1)
+if [ $# -eq 0 ]; then
+ RUN_COMMAND="/bin/bash"
+else
+ RUN_COMMAND="${@}"
+fi
which docker &>/dev/null || die "docker must be on the PATH."
@@
-55,4
+61,4
@@
else
die "failed to find a docker image named ${DOCKER_IMAGE_NAME}"
fi
-docker exec -it "${DOCKER_IMAGE_ID}" /bin/bash
+docker exec -it "${DOCKER_IMAGE_ID}" ${RUN_COMMAND}