Created
October 14, 2019 15:11
-
-
Save arsu-leo/ac55fb4430a97ad8718e2d2471540a0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DQUOTE=$(echo "\42") | |
SQUOTE=$(echo "\47") | |
COMMAND="mysql -u USER -pPASSWD -h HOST --default-character-set=utf8 \ | |
--database=DB --batch -e ${DQUOTE}SELECT * FROM SOMEWHERE${DQUOTE} | \ | |
sed ${SQUOTE}s/${DQUOTE}/${DQUOTE}${DQUOTE}/g;s/\t/${DQUOTE},${DQUOTE}/g;s/^/${DQUOTE}/;s/$/${DQUOTE}/;s/\n//g;s/\\n/\n/g${SQUOTE} \ | |
> ${VOLUME_OUTPUT_FILE}" | |
docker run \ | |
--network ${NETWORK} \ | |
--volume ${OUTPUT_FOLDER}:${VOLUME_OUTPUT_FOLDER} \ | |
mysql sh -c "${COMMAND}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment