How can I suppress error messages for a shell command?
For example, if there are only jpg files in a directory, running ls *.zip gives an e
jpg
ls *.zip
Most Unix commands, including ls, will write regular output to stdout and error messages to stderr so you can use bash redirection to throw away the error messages while leaving the regular output in place:
ls
ls *.zip 2> /dev/null