Improve 2001/westley/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-01-19 10:18:07 -08:00
1 parent 1ef24be70c
commit 81da08da8d
1 file changed
+46 -19
+46 -19
View File
@@ -15,40 +15,67 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "./westley < westley.c 2>/dev/null > westley2.c" 1>&2
./westley < westley.c 2>/dev/null > westley2.c
echo "$ ./westley < westley.c 2>/dev/null | tee westley2.c" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./westley < westley.c 2>/dev/null | tee westley2.c | less -rEXF
echo "Compiling westley2.c..." 1>&2
make CC="$CC" westley2 2>/dev/null 1>&2
echo
echo 1>&2
echo "$ echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null"
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null
echo
echo 1>&2
read -r -n 1 -p "Press any key to run: make CC=\"$CC\" westley.sort 2>/dev/null: "
echo 1>&2
make CC="$CC" westley.sort 2>/dev/null 1>&2
echo
echo "./westley.sort < westley.c 2>/dev/null | diff - westley.c"
echo 1>&2
echo "$ ./westley.sort < westley.c 2>/dev/null | diff -s - westley.c"
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
# SC2094 (info): Make sure not to read and write the same file in the same pipeline.
# shellcheck disable=SC2094
./westley.sort < westley.c 2>/dev/null | diff - westley.c
echo "./westley.sort < westley.c 2>/dev/null | diff - westley2.c"
./westley.sort < westley.c 2>/dev/null | diff - westley2.c
echo "./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c"
./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c
echo "./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c"
./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c
./westley.sort < westley.c 2>/dev/null | diff -s - westley.c | less -rEXF
echo 1>&2
echo
echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley2.c"
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./westley.sort < westley.c 2>/dev/null | diff -s - westley2.c | less -rEXF
echo 1>&2
echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c"
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./westley.sort < westley.c 2>/dev/null | diff - westley.sort.c | less -rEXF
echo 1>&2
echo "$ ./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c"
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./westley.sort < westley.c 2>/dev/null | diff - westley.punch.c | less -rEXF
echo 1>&2
# SC2028 (info): echo may not expand escape sequences. Use printf.
# shellcheck disable=SC2028
echo "printf \"1\n\4\n5\" | ./westley 2>/dev/null"
read -r -n 1 -p "Press any key to run: printf \"1\n\4\n5\" | ./westley 2>/dev/null: "
echo 1>&2
printf "1\n4\n5" | ./westley 2>/dev/null
echo 1>&2
echo
echo 1>&2
# SC2028 (info): echo may not expand escape sequences. Use printf.
# shellcheck disable=SC2028
echo "printf \"1\n4\n5\" | ./westley 2>/dev/null"
read -r -n 1 -p "Press any key to run: printf \"1\n4\n5\" | ./westley 2>/dev/null: "
echo 1>&2
printf "1\n4\n5" | ./westley 2>/dev/null
echo 1>&2
echo
echo "echo 'Hello, world!' | ./westley.punch 2>/dev/null"
echo 1>&2
read -r -n 1 -p "Press any key to run: echo 'Hello, world!' | ./westley.punch 2>/dev/null: "
echo 1>&2
echo 'Hello, world!' | ./westley.punch 2>/dev/null