Open periish opened 4 years ago
I was able to reproduce.
@spiralofhope is you sh not symlinked to zsh? Here is how I reproduced:
$ echo 'printf %d "$1" >/dev/null 2>&1' >test.sh
$ sh ./test.sh not_number
! # <-- correct exit code
$ ln -s $(which zsh) ./sh
$ ./sh ./test.sh "not_number"
$ # exit code of 0
You noted an exit code of !
, did you mean 1
?
My sh is symlinked to dash 0.5.10.2-5
echo 'printf %d "$1" >/dev/null 2>&1' >test.sh
# Actually dash:
sh ./test.sh not_number ; echo $?
1
ln -s $(which zsh) ./sh
./sh ./test.sh "not_number"; echo $?
0
At no point in my tests does the printf
display anything.
oh yeah my bad - the error I was trying to highlight was the exit code, I don't print anything either, of course.
Unless I misunderstood:
Reproduced in zsh
5.7.1-1
under a Debian 10.1.0-amd64 install, (though updated recently).Running that script with a header of
#!/usr/bin/env sh
and using the script./script.sh 1
produces no output.