调用shell脚本时,bash中的exec命令不起作用

use*_*188 0 linux bash shell exec

以下是存储在同一文件夹中的两个shell脚本,两个脚本都具有执行权限:

shell1.sh

#!/bin/bash
exec shell2.sh
Run Code Online (Sandbox Code Playgroud)

shell2.sh

#!/bin/bash
pwd
Run Code Online (Sandbox Code Playgroud)

尝试执行shell1.sh时收到以下错误:

./shell1.sh: line 3: exec: shell2.sh: not found
Run Code Online (Sandbox Code Playgroud)

有什么我做错了吗?这适用于其他机器,但只是在一个特定的服务器中它无法正常工作.

任何的意见都将会有帮助.

Wal*_*r A 5

当前目录不是PATH的一部分.尝试

exec ./shell2.sh
Run Code Online (Sandbox Code Playgroud)