Add 1998/df/try.sh

This script runs repeatedly until (when prompted) one hits 'q' (or 'Q')
or else sends ctrl-c/intr. I also added a question to the extra credit
questions: are there any misspelt words and if there are what are they?
I also added that there's a way to cheat very easily but I did not say
how to do it. It should be pretty obvious how to do it to anyone who
tries the program once or if not once a few times.
This commit is contained in:
Cody Boone Ferguson committed 2024-01-19 06:57:28 -08:00
1 parent ed47e4ab55
commit 99e79b1e13
3 files changed
+46 -3

No files matched your search

Executable
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 1998/df
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
while [[ 1 ]]; do
read -r -n 1 -p "Press any key to run ./df or 'q' to quit: "
echo 1>&2
if [[ "$REPLY" = "q" || "$REPLY" = "Q" ]]; then
exit 0
fi
./df
done