Is there any difference between the below two commands?
ls -l some_non_existing_file 2>/dev/null
and
ls -l some_non_existing_file 2>&-
Both seems to work but I have seen only the first one being used practically so far.
Attempts by the program to output data to stderr will fail in the second case with EBADF. Whether the program cares or not is a separate issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With