Skip to content

Instantly share code, notes, and snippets.

@astral1
Last active August 29, 2015 14:05
Show Gist options
  • Save astral1/c3971beffa8f9f4fedfe to your computer and use it in GitHub Desktop.
Save astral1/c3971beffa8f9f4fedfe to your computer and use it in GitHub Desktop.
Command Line Tool Wrapper for Docker
#!/usr/bin/env bash
echo $@ | grep -q ' - '
if [ $? -eq 0 ]
then
ENTRYPOINT=$1
shift
while [ "x$1" != "x-" ]
do
ENTRYPOINT="$ENTRYPOINT $1"
shift
done
shift
REQ_COMMAND=$@
else
ENTRYPOINT=$@
fi
if [ -z "$REQ_COMMAND" ]
then
$ENTRYPOINT
else
$ENTRYPOINT "$REQ_COMMAND"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment