Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
cmd () {
CMD_CONT="bash -c '${1}' "
echo $CMD_CONT
docker run --rm --volumes-from $CONT_NAME ubuntu:14.04 $CMD_CONT
}
cmd "ls -l /"
# bash -c 'ls -l /'
# -l: -c: line 0: unexpected EOF while looking for matching `''
# -l: -c: line 1: syntax error: unexpected end of file
cmd () {
CMD_CONT="bash -c \'${1}\' "
echo $CMD_CONT
docker run --rm --volumes-from $CONT_NAME ubuntu:14.04 $CMD_CONT
}
# bash -c \'ls -l /var/www/*\'
# -l: 'ls: command not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment