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
$ ls *.zip 2>/dev/null
will redirect any error messages on stderr to /dev/null (i.e. you won't see them)
Note the return value (given by $?) will still reflect that an error occurred.
$?