These two errors are not treated in the same manner. One has told me that env is not a builtin in bash. Why the exit codes are different ?
pwd -y
bash: pwd: -y: invalid option
echo $?
2
env -y
env: invalid option -- 'y'
echo $?
125
I use GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu). I don't find the response on google. I'd like just to understand it.