> Hi, how could I know if $stderr has been redirected to /dev/null?

On anything sufficiently Unix-like, you could fstat the filehandle and =
stat the path (/dev/null) and check the major and minor device numbers.=