当我尝试执行我的脚本时,我遇到一个错误:
bash: /home/thai/first3.sh: /home/thai: bad interpreter: permission denied 下面是我的脚本:
#!/home/thai
for file in *
do
if grep -l 'main()' $file
then
more $file
fi
done
exit 0我想我的脚本出了点问题,但是我搞不清楚,有没有人能帮帮我。我运行的是Ubuntu Linux。
发布于 2020-06-12 15:52:25
您声明的shebang不正确。文件的第一行应该是:
#!/bin/bash而不是您的HOME目录。此外,您的脚本也可以简化。试试这个:
#!/bin/bash
for file in $(grep -l 'main()' *); do
more $file
donehttps://stackoverflow.com/questions/62339833
复制相似问题