Add 2015/endoh4/try.sh + format/typo checks

This commit is contained in:
Cody Boone Ferguson committed 2023-12-08 10:38:42 -08:00
1 parent d9b2810392
commit 549633020f
3 files changed
+77 -12

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2015/endoh4
#
# 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
PERL="$(type -P perl)"
echo "$ ./prog @" 1>&2
./prog @
echo "$ ./prog @ @" 1>&2
./prog @ @
echo "$ ./prog @ @ @" 1>&2
./prog @ @ @
echo "$ ./prog @ @ @ @ @" 1>&2
./prog @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @ @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @ @ @ @ @ @ @
echo "$ ./prog \"\$(< Makefile)\"" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
./prog "$(< Makefile)"
if [[ -n "$PERL" ]]; then
echo "$ ./prog \$($PERL -e 'print "@ " x (2*3*5*7);')" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
./prog "$($PERL -e 'print "@ " x (2*3*5*7);')"
fi