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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.