$ beep; echo $?
Command 'beep' not found, but can be installed with:
apt install beep
Please ask your administrator.
127
$ cat test.sh
#!/usr/bin/env bash
echo $?
我的脚本的预期输出应该是“127”。
那么,为什么以同样的方式执行bash脚本后,打印的返回代码不是我们所期望的?
$ beep; ./test.sh
Command 'beep' not found, but can be installed with:
apt install beep
Please ask your administrator.
0