not foundsh:2:exectutin shell命令时出错?

时间:2014-10-31 09:56:19

标签: shell

当我运行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

1 个答案:

答案 0 :(得分:1)

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

dos2unix backuptest.sh

然后再次使用

执行
./backuptest.sh