From be0d6aa0afe13428adac9898b04af483c339fe92 Mon Sep 17 00:00:00 2001 From: Ezri Zhu Date: Fri, 6 Sep 2024 00:40:44 -0400 Subject: [PATCH] shellcheck and use grep instead of diff --- test/stdstream.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/stdstream.sh b/test/stdstream.sh index 8e70f74..4878fee 100755 --- a/test/stdstream.sh +++ b/test/stdstream.sh @@ -20,9 +20,13 @@ sh_stdout=$(mktemp) sh_stderr=$(mktemp) # test stdout -echo 5 | "$TRY" "$cmdfile" >$try_stdout 2>$try_stderr -echo 5 | sh "$cmdfile" >$sh_stdout 2>$sh_stderr +echo 5 | "$TRY" "$cmdfile" >"$try_stdout" 2>"$try_stderr" +echo 5 | sh "$cmdfile" >"$sh_stdout" 2>"$sh_stderr" -diff $try_stdout $sh_stdout || exit 1 -diff $try_stderr $sh_stderr || exit 1 -rm $try_stdout $try_stderr $sh_stdout $sh_stderr +diff "$try_stdout" "$sh_stdout" || exit 1 + +# using grep because there's try errors printed +grep -q 15 "$try_stderr" +grep -q 15 "$sh_stderr" + +rm "$try_stdout" "$try_stderr" "$sh_stdout" "$sh_stderr"