From 952f54e48416e47645cd277de86774525e74c40f Mon Sep 17 00:00:00 2001 From: Colin P. Mccabe Date: Tue, 29 Nov 2016 14:53:29 -0800 Subject: [PATCH] dssh: add the ability to execute arbitrary commands --- dssh | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/dssh b/dssh index a00ca4d..710fdac 100755 --- 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} -- 1.6.6.rc1.39.g9a42