![](/img/trans.png)
[英]BASH: grep doesn't work in shell script but echo shows correct command and it works on command line
[英]exec command in bash doesn't work when calling a shell script
以下是存储在同一文件夹中的两个外壳脚本,它们对两个脚本均具有执行权限:
shell1.sh
#!/bin/bash
exec shell2.sh
shell2.sh
#!/bin/bash
pwd
尝试执行shell1.sh时,出现以下错误:
./shell1.sh: line 3: exec: shell2.sh: not found
我做错了什么吗? 尽管这可以在其他机器上使用,但是只能在一台特定的服务器上无法使用。
任何的意见都将会有帮助。
当前目录不是您的PATH的一部分。 尝试
exec ./shell2.sh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.