MSR: Support empty `#>` directive
The Markdown Shell Recorder now also tests if a command prints nothing
to `stdout` if you add the check `#>`. Before this update this test
would never fail, because the Shell Recorder checked if the output
contains the empty string, which is always the case.
@@ -12,7 +12,7 @@ resetGlobals()
WARNINGS=
STDOUTRE=
unset STDERR
- STDOUT=
+ unset STDOUT
MOUNTPOINT=
}
@@ -23,7 +23,7 @@ writeBlock()
[ -n "$ERROR" ] && printf 'ERROR: %s\n' "$ERROR" >> "$TMPFILE"
[ -n "$WARNINGS" ] && printf 'WARNINGS: %s\n' "$WARNINGS" >> "$TMPFILE"
[ -n "${STDERR+unset}" ] && printf 'STDERR: %s\n' "$STDERR" >> "$TMPFILE"
- if [ -n "$STDOUT" ]; then printf 'STDOUT: %s\n' "$STDOUT" >> "$TMPFILE"
+ if [ -n "${STDOUT+unset}" ]; then printf 'STDOUT: %s\n' "$STDOUT" >> "$TMPFILE"
elif [ -n "$STDOUTRE" ]; then printf 'STDOUT-REGEX: %s\n' "$STDOUTRE" >> "$TMPFILE"
fi
COMMAND=$(sed s/sudo\ //g <<< "$COMMAND")
