Quantcast
Channel: Is there a simple test for anything printed on stderr in shell/Bash? - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 4 View Live

Answer by Notiz Me for Is there a simple test for anything printed on stderr...

The most voted answer will work in most cases. But since I use set +o errexit in bash it errored out. This should work better in bash:fail_if_stderr() ( # save current options bash_options="${-}" #...

View Article



Answer by Stéphane Chazelas for Is there a simple test for anything printed...

You could do (POSIXly):if { cmd 2>&1 >&3 3>&- | grep '^'>&2; } 3>&1; then echo there was some output on stderrfiOr to preserve the original exit status if it was...

View Article

Answer by DopeGhoti for Is there a simple test for anything printed on stderr...

# output "NOK" if standard error has any output; "OK" otherwise:errlog=$(mktemp)somecommand 1>> "$stdlog" 2> "$errlog"if [[ -s "$errlog" ]]; then # File exists and has a size greater than zero...

View Article

Is there a simple test for anything printed on stderr in shell/Bash?

I'd like invoke a command inside a shell script for Continuous Integration purposes. Exit status 0 means succes, otherwise failure. I'm writing a wrapper script to run several commands and fail if any...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images