dssh: handle quoted arguments better
authorColin P. Mccabe <colin@cmccabe.xyz>
Fri, 9 Dec 2016 23:51:17 +0000 (15:51 -0800)
committerColin P. Mccabe <colin@cmccabe.xyz>
Fri, 9 Dec 2016 23:51:17 +0000 (15:51 -0800)
dssh

diff --git a/dssh b/dssh
index 14dd22c..9799ec0 100755 (executable)
--- a/dssh
+++ b/dssh
@@ -48,7 +48,7 @@ shift $(expr $OPTIND - 1)
 if [ $# -eq 0 ]; then
     RUN_COMMAND="/bin/bash"
 else
-    RUN_COMMAND="${@}"
+    RUN_COMMAND=""
 fi
 
 which docker &>/dev/null || die "docker must be on the PATH."
@@ -71,8 +71,8 @@ else
 fi
 
 if [ ${ALLOCATE_TTY} == 1 ]; then
-    docker exec -it "${DOCKER_IMAGE_ID}" ${RUN_COMMAND}
+    docker exec -it "${DOCKER_IMAGE_ID}" "${@}" ${RUN_COMMAND}
 else
-    docker exec -i "${DOCKER_IMAGE_ID}" ${RUN_COMMAND} &
+    docker exec -i "${DOCKER_IMAGE_ID}" "${@}" ${RUN_COMMAND} &
     wait
 fi