Created
April 26, 2016 13:46
-
-
Save edmondscommerce/b8c39df2ff000afd72dff156eccdacd5 to your computer and use it in GitHub Desktop.
BASH function to get the config value for a variable from MySQL
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
function getCurrentMysqlConfigForVariable(){ | |
local variable=$1 | |
mysql -e "select variable_value from information_schema.global_variables where variable_name like '$variable'" | | |
while read variable_value; | |
do | |
if [[ 'variable_value' == "$variable_value" ]] | |
then | |
# skip the header | |
continue | |
fi | |
echo $variable_value | |
return 0 | |
done | |
return 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: