Thread: suppress stderr in a bash script
hi,
have bash script in cases print out error messages various commands ls, grep, head, tail. see following options:
-supplement each single 1 of commands "2>/dev/null" <--doing currently
-tell people use script invoke "2>/dev/null"
-build (otherwise unnecessary) tests files , directories prevent errors
-have confusing error messages printed user
wondering if there kind of global setting that, same effect invoking script "2>/dev/null", maybe silent argument in "#!/bin/bash" line or something? hope making sense...
if think, errors going confusing users, shall use tests before calling external commands prevent errors.
otherwise, let users see errors.
anyway, i've observed (in scripts, part of system, initscripts), common practice test before calling, unless desired show possible stderr output user.
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [all variants] suppress stderr in a bash script
Ubuntu
Comments
Post a Comment