我有一个包含以下内容的sh脚本:
#!/bin/sh
mysqldump -hmy.host.com --user=p387829 --password=pwd --
all-databases > /backup/mysqlall-`/bin/date +\%Y\%m\%d\%h\%i\%s`.sql
mysqldump -u p387829 -hmy.host.com --password=pwd --add-
drop-table --no-data usr_p387829_1 | grep ^DROP | mysql -up387829 -
pPwd -hmy.host.com usr_p387829_1
mysqldump -u p387829 -hmy.host.com --password=pwd
usr_p387829_2 | mysql -u p387829 -pPwd -hmy.host.com
usr_p387829_1
当我在shell中逐个执行每个命令时,它是有效的。但当我执行sh script.sh时,就会出现问题。
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
'RROR 1102 (42000): Incorrect database name 'usr_p387829_1
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
'RROR 1102 (42000): Incorrect database name 'usr_p387829_1
mysqldump: Got errno 32 on write