Quantcast
Viewing all articles
Browse latest Browse all 4

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

# 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    echo "NOK"else    echo "OK"fi# Done parsing standard error; tack it to the regular logcat "$errlog">> "$stdlog"rm -f "$errlog"

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>