$ 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 $?
The expected output of my script should be “127”.
Why, then, after executing the bash script in the same manner, the return code printed is not what we expect?
$ beep; ./test.sh
Command 'beep' not found, but can be installed with:
apt install beep
Please ask your administrator.
0