dssh: add the ability to execute arbitrary commands
[cmccabe-bin] / dssh
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}