“sh: #: 未知操作数” - 如何消除 shell 脚本中的这个错误?

“sh: #: 未知操作数” - 如何消除 shell 脚本中的这个错误?

我有一个 shell 脚本,它在执行时工作正常,但是会给出警告:

sh: #: unknown operand

在这个shell脚本中,我想注释掉进程“process1”和“process2”,它们也是为其他任务设计的shell脚本,在注释掉它们之后,我想将path1的内容传输到path2中的文件中

#!/bin/sh
rootpath="/opt/storage"
datestring=`date +"%y-%m-%d"`
touch newfile1
touch newfile2
autorun_contents=`cat FILE1`
if [ ! -f ${FILE1} ] || [ -z "`echo \"${FILE1}\" | tail -10 | grep EOF`" ]; then
echo "Something was wrong with the file"
return
fi
sed "s/.\/process1/# .\/process1/g" FILE1 > FILE2 | echo "Hi1"
sed "s/.\/process2/# .\/process2/g" FILE1 > FILE2 | echo "Hi2"

任何建议都将不胜感激。谢谢!

相关内容