From 19afcc9d45f9699eecca3738765ee92fb69cab63 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:34:14 -0800 Subject: [PATCH] Improve 2019/diels-grabsch1/try.sh --- 2019/diels-grabsch1/try.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/2019/diels-grabsch1/try.sh b/2019/diels-grabsch1/try.sh index 7ae705288..f2d046e16 100755 --- a/2019/diels-grabsch1/try.sh +++ b/2019/diels-grabsch1/try.sh @@ -15,34 +15,43 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ dd bs=1024 count=2048 < /dev/zero | compress > ref.Z" 1>&2 +read -r -n 1 -p "Press any key to run: dd bs=1024 count=2048 < /dev/zero | compress > ref.Z: " +echo 1>&2 dd bs=1024 count=2048 < /dev/zero | compress > ref.Z echo 1>&2 -echo "$ dd bs=1024 count=2048 < /dev/zero | ./prog > dg1.Z" 1>&2 +read -r -n 1 -p "Press any key to run: dd bs=1024 count=2048 < /dev/zero | ./prog > dg1.Z: " +echo 1>&2 dd bs=1024 count=2048 < /dev/zero | ./prog > dg1.Z echo 1>&2 -echo "$ cmp ref.Z dg1.Z" 1>&2 +read -r -n 1 -p "Press any key to run: cmp ref.Z dg1.Z: " +echo 1>&2 cmp ref.Z dg1.Z echo "Exit code of: cmp ref.Z dg1.Z: $?" 1>&2 echo 1>&2 -echo "$ compress < Shakespeare.txt > ref.Z" 1>&2 +read -r -n 1 -p "Press any key to run: compress < Shakespeare.txt > ref.Z: " +echo 1>&2 compress < Shakespeare.txt > ref.Z echo 1>&2 -echo "$ ./prog < Shakespeare.txt > dg1.Z" 1>&2 +read -r -n 1 -p "Press any key to run: ./prog < Shakespeare.txt > dg1.Z: " +echo 1>&2 ./prog < Shakespeare.txt > dg1.Z echo 1>&2 -echo "Notice how the files differ:" 1>&2 -echo "$ cmp ref.Z dg1.Z" 1>&2 +echo "Notice how the two files differ:" 1>&2 +read -r -n 1 -p "Press any key to run: cmp ref.Z dg1.Z: " +echo 1>&2 cmp ref.Z dg1.Z # Oops, the files differ echo "Exit code of: cmp ref.Z dg1.Z: $?" 1>&2 echo 1>&2 echo "... and notice how this works fine:" 1>&2 -echo "$ zcat < dg1.Z | cmp - Shakespeare.txt" 1>&2 +read -r -n 1 -p "Press any key to run: zcat < dg1.Z | cmp - Shakespeare.txt: " +echo 1>&2 zcat < dg1.Z | cmp - Shakespeare.txt +echo "Exit code of zcat < dg1.Z | cmp - Shakespeare.txt: ${PIPESTATUS[1]}" +echo 1>&2 echo "What happened?"