Created
January 10, 2014 06:12
-
-
Save lifuzu/8347690 to your computer and use it in GitHub Desktop.
bash to list mysql database, set them to array
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
while read dbname; do dbarray+=("$dbname"); done < <(mysql -u username -ppassword -e 'show databases;' -B | grep reviewdb) | |
echo ${dbarray[*]} | |
for dbname in `echo ${dbarray[*]}`; do echo $dbname; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank You very much!
Better to add -N parameter for mysql command
J.M.