Created
October 11, 2018 14:02
-
-
Save ericksuryadinata/94acdfcd6b840ad206aa79c1e2a42156 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
exit=1 | |
getout=0 | |
if [ "$1" = "" ]; | |
then | |
echo "You must suply filename to import" | |
getout=1 | |
else | |
file=$1 | |
fi | |
if [ "$2" = "" ]; | |
then | |
echo "You must suply username of your mysql" | |
getout=1 | |
fi | |
if [ "$3" = "" ]; | |
then | |
echo "You must suply your destination database" | |
getout=1 | |
fi | |
if [ "$getout" -eq "$exit" ] | |
then | |
echo "usage = pv FILENAME | mysql -u USERNAME -p DATABASE" | |
exit | |
else | |
if [ "${file##*.}" = "sql" ] | |
then | |
pv $1 | mysql -u $2 -p $3 | |
else | |
echo "You must specified sql file" | |
echo "${file##*.}" | |
exit | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment