当我运行sh backuptest.sh时,出现以下错误。代码或我的shell是否有问题

result :
: not foundsh: 2: backuptest.sh:
: not foundsh: 4: backuptest.sh:
: not foundsh: 6: backuptest.sh:
: not foundsh: 7: backuptest.sh:



content of backuptest.sh
#!/bin/sh -e
location=`date +%Y%m%d`.sql
mysqldump -u root -proot spider_db > $location

最佳答案

删除#!/bin/sh -e并尝试

dos2unix backuptest.sh


然后再次执行

./backuptest.sh

08-27 16:37