The following command is throwing an unterminated substitute pattern
error in bash:
eval $(echo "sed '" "s,@\("{a..u}{a..z}"\),\n\n\1,;" "'")
But not for everyone. Linux apparently works fine. Mac throws the unterminated substitute pattern error.
How can I reorganize to make this work?
Here's the entire bash command (the goal is to cleanly output current MySQL settings into my.cnf) :
{
# Print version, user, host and time
echo -e "# MYSQL VARIABLES {{{1\n##\n# MYSQL `
mysql -V | sed 's,^.*\(V.*\)\, for.*,\1,'
` - By: `logname`@`hostname -f` on `date +%c`\n##"
for l in {a..z}; do
# Get mysql global variables starting with $l
echo '#'; mysql -NBe "SHOW GLOBAL VARIABLES LIKE '${l}%'" |
# Transorm it
sed 's,\t,^= ,' |
column -ts^ |
tr "\n" '@' |
eval $(echo "sed '" "s,@\("{a..u}{a..z}"\),\n\n\1,;" "'") |
eval $(echo "sed '" "s,@\(innodb_"{a..z}{a..z}"\),\n\n\1,;" "'") |
tr '@' "\n" |
sed 's,^,# ,g'
done
echo -e "#\n##\n# MYSQL VARIABLES }}}1";
} | tee ~/mysql-variables.log