[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hi how to escaping under ` ` in sh



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 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 ``
> 

mysql .... | while read; do
	mysqldump -e "$REPLY" > ...
done



Reply to: