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 with that output? > > > > mysql -u root -pmy\$ql -N -B -e 'show databases' > > works > > 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; \
mysqldump --all-databases ? > done $ mysql mysql -e 'show databases' +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test123 | +--------------------+ $ mysql mysql --batch -e 'show databases' Database information_schema mysql test123 $ mysql mysql --batch --silent -e 'show databases' information_schema mysql test123 > > to work. > > > BTW: I would suggest that you actually use a .my.cnf to hold the > > password, otherwise the password is available in e.g. the output of 'ps > > auxww' > > > > yes I would eventually do that but even then you need to escape the $ inside > `` In that case, the '$' is not part of the command-line, and hence no need to escape it. -- Tzafrir Cohen | tzaf...@jabber.org | VIM is http://tzafrir.org.il | | a Mutt's tzaf...@cohens.org.il | | best tzaf...@debian.org | | friend -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20100421092540.gw16...@pear.tzafrir.org.il