Discuss Without backticks? in the Linux Help forum on Dev Shed. Without backticks? Linux Help forum discussing topics including usage, troubleshooting, modules, and distributions. Linux is an open source OS, based on UNIX.
Posts: 364
Time spent in forums: 3 Days 7 h 49 m 59 sec
Reputation Power: 188
Sinec there isn't a way to do it by modifying the mySQL command itself, I've just posted the same question in the Linux forum, to see if there is a way on that part of the puzzle.
I'm hoping there is some fancy workaround that I have not considered (or had no idea could be done)
Posts: 2,108
Time spent in forums: 1 Month 1 Week 1 Day 4 h 16 m 23 sec
Reputation Power: 1485
Have you tried quoting them?
Code:
show databases WHERE \`Database\` LIKE "central\_%"
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc
Posts: 2,108
Time spent in forums: 1 Month 1 Week 1 Day 4 h 16 m 23 sec
Reputation Power: 1485
I seem to recall having used nested backticks before, but it was a mess, and it was for nested commands, not delimiting a name - though I do not think that should matter.
As b49P23TIvg says, however, you should really replace the command quotes of `...` with $(...). Apart from backticks being deprecated I, personally, find the $(...) syntax far easier to read.
Posts: 364
Time spent in forums: 3 Days 7 h 49 m 59 sec
Reputation Power: 188
I hope people don't find this too confusing...
This original thread was posted in the mySQL forum, then a second thread in the linux forum to tackle it from another direction.
It looks like this thread was later moved to the linux forum when the direction changed...
I hope that clears some things up a bit.
One of the last solutions was this:
Code:
function doit {
mysql -Bse 'show databases WHERE `Database` LIKE "central\_%" OR `Database` LIKE "facebook\_%"'
}
for database in `doit` ; do
echo $database
done
I also can do it this way by changing the requirements just a bit:
Code:
for database in `mysql -Bse 'show databases'`
do
if [[ $database =~ ^(facebook|central)\_ ]]
then
do something
fi
done
I assume the later can be modified using the $(...) syntax???