Add 2018/burton1/try.sh, rename scripthd, ...

The scripthd is now called scripthd.sh to help GitHub/browsers with
whether or not to download or show it.

The try.sh script uses the script to show the differences between it and
prog.

The README.md file has been format/typo checked.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-14 10:46:25 -08:00
1 parent 7f4204bed8
commit 8cb287d7b8
3 files changed
+80 -18

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2018/burton1
#
# 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" everything >/dev/null || exit 1
for i in prog scripthd.sh; do
echo "$ ./$i < prog.c" 1>&2
./"$i" < prog.c
echo 1>&2
read -r -n 1 -p "Press any key to run: ./$i < prog (space = next page, q = quit): "
echo 1>&2
./"$i" < prog | less -EXF
echo 1>&2
read -r -n 1 -p "Press any key to run: ./$i < scripthd.sh (space = next page, q = quit): "
echo 1>&2
./"$i" < scripthd.sh | less -EXF
echo 1>&2
read -r -n 1 -p "Press any key to run: head $0 | ./$i: "
echo 1>&2
head "$0" | ./"$i"
echo 1>&2
read -r -n 1 -p "Press any key to run: tail -n 15 Makefile | ./$i: "
echo 1>&2
tail -n 15 Makefile | ./"$i"
done