suppress stderr in a bash script
hi,
i have a bash script that in some cases will print out error messages from various commands like ls, grep, head, tail. currently i see the following options:
-supplement each single one of those commands with "2>/dev/null" <--doing that currently
-tell the people who use the script to invoke it with "2>/dev/null"
-build (otherwise unnecessary) tests for files and directories to prevent errors
-have confusing error messages printed to the user
but i was wondering if there was some kind of global setting for that, to the same effect as invoking the script itself with "2>/dev/null", maybe like a silent argument in the "#!/bin/bash" line or something? hope i am making sense...
As you can see from my history, i was once an enthusiastic ubuntu user. I would hereby like to assert that i no longer recommend using ubuntu to anyone. I recommend using one of the many distributions that do not include ad-/spyware by default.
Bookmarks