File: exitcode-for-output.sh

package info (click to toggle)
rtl-433 25.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,192 kB
  • sloc: ansic: 55,982; cpp: 3,263; python: 2,544; php: 55; javascript: 43; sh: 18; makefile: 16
file content (6 lines) | stat: -rwxr-xr-x 131 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
#!/bin/sh

# execute command and set exit code 1 if there is output on stdout or stderr
out=$("$@" 2>&1)
echo "$out"
[ -z "$out" ]