Hi how to escaping under ` ` in sh

2010-04-21 Thread Siju George
Hi, mysql -u root -pmy\$qlPW -N -B -e 'show databases' gives the right output but `mysql -u root -pmy\$qlPW -N -B -e 'show databases'` gives ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) I hope it is the escaping issue with $ inside ``? How do you do

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Nick Douma
On Wed, Apr 21, 2010 at 01:44:33PM +0530, Siju George wrote: Hi, mysql -u root -pmy\$qlPW -N -B -e 'show databases' gives the right output but `mysql -u root -pmy\$qlPW -N -B -e 'show databases'` gives ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Siju George
On Wed, Apr 21, 2010 at 2:01 PM, Nick Douma n.do...@nekoconeko.nl wrote: When using single quotes ('), everything in the string is literal, so no escaping is required. You only need escaping when using double quotes (). It is not quotes '' but `` :-) thanks --Siju -- To UNSUBSCRIBE,

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Mart Frauenlob
On 21.04.2010 10:14, Siju George wrote: Hi, mysql -u root -pmy\$qlPW -N -B -e 'show databases' gives the right output but `mysql -u root -pmy\$qlPW -N -B -e 'show databases'` gives ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) I hope it is

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Siju George
On Wed, Apr 21, 2010 at 2:16 PM, Mart Frauenlob mart.frauen...@chello.at wrote: how about: ... -p 'my$qlPW' -N ... # `mysql -u root -p 'my$qlPW' -N -B -e 'show databases'` Enter password: asks for PW # `mysql -u root -p'my$qlPW' -N -B -e 'show databases'` -bash: information_schema: command

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Tzafrir Cohen
On Wed, Apr 21, 2010 at 02:27:47PM +0530, Siju George wrote: On Wed, Apr 21, 2010 at 2:16 PM, Mart Frauenlob mart.frauen...@chello.at wrote: how about: ... -p 'my$qlPW' -N ... # `mysql -u root -p 'my$qlPW' -N -B -e 'show databases'` Enter password: asks for PW # `mysql -u root

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Mart Frauenlob
On 21.04.2010 10:57, Siju George wrote: On Wed, Apr 21, 2010 at 2:16 PM, Mart Frauenlob mart.frauen...@chello.at wrote: # `mysql -u root -p'my$qlPW' -N -B -e 'show databases'` -bash: information_schema: command not found there we go... now, i guess u want to save the output of the command

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Siju George
On Wed, Apr 21, 2010 at 2:31 PM, Tzafrir Cohen tzaf...@cohens.org.il wrote: You got the output of 'show databases'. You then consider it a shell command and try to excute it. Why would you want to do that? What do you want to do with that output? mysql -u root -pmy\$ql -N -B -e 'show

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Mart Frauenlob
On 21.04.2010 11:10, Siju George wrote: [...] I was to get the script #!/bin/sh for DB in `mysql -u root -pmy\$qlPW -N -B -e 'show databases'`; \ do echo $DB; \ mysqldump -u root -pmy\$qlPW -e $DB /var/mysql-1hBak/$DB.sql; \ done to work. BTW: I would suggest that you

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Tzafrir Cohen
On Wed, Apr 21, 2010 at 02:40:54PM +0530, Siju George wrote: On Wed, Apr 21, 2010 at 2:31 PM, Tzafrir Cohen tzaf...@cohens.org.il wrote: You got the output of 'show databases'. You then consider it a shell command and try to excute it. Why would you want to do that? What do you want to do

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Siju George
On Wed, Apr 21, 2010 at 2:46 PM, Mart Frauenlob mart.frauen...@chello.at wrote: mysql | while read; do        mysqldump -e $REPLY ... done Thanks a million :-) It is working!!! --Siju -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe.

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Wes Garland
Try `mysql -u root -pmy\\\$qlPW -N -B -e 'show databases'` I think that's right. Escape the $ so it doesn't get processed by the current shell, escape the slash so it doesn't get processed, falls to \$ which then re-escapes the $ for passing into mysql as part of your password. Nick is on to

Re: Hi how to escaping under ` ` in sh

2010-04-21 Thread Alexander Samad
On Wed, Apr 21, 2010 at 11:04 PM, Wes Garland w...@page.ca wrote: Try `mysql -u root -pmy\\\$qlPW -N -B -e 'show databases'` I think that's right. Escape the $ so it doesn't get processed by the current shell, escape the slash so it doesn't get processed, falls to \$ which then re-escapes