diff --git a/2020/endoh2/README.md b/2020/endoh2/README.md index 51992ebc0..ecc61daf5 100644 --- a/2020/endoh2/README.md +++ b/2020/endoh2/README.md @@ -15,15 +15,17 @@ make ### Try: ```sh -./prog - -./prog hello.txt - -./prog yoda.txt - -./prog bear.txt +./try.sh ``` +What happens if you do + +```sh +./prog prog.c +``` + +? + ## Judges' remarks: diff --git a/2020/endoh2/try.sh b/2020/endoh2/try.sh new file mode 100755 index 000000000..792637626 --- /dev/null +++ b/2020/endoh2/try.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2020/endoh2 +# + +# 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 + +read -r -n 1 -p "Press any key to run: ./prog: " +echo 1>&2 +./prog +echo 1>&2 + +read -r -n 1 -p "Press any key to show hello.txt: " +echo 1>&2 +cat hello.txt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./prog hello.txt: " +echo 1>&2 +./prog hello.txt +echo 1>&2 + +read -r -n 1 -p "Press any key to show yoda.txt: " +echo 1>&2 +cat yoda.txt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./prog yoda.txt: " +echo 1>&2 +./prog yoda.txt + +read -r -n 1 -p "Press any key to show bear.txt: " +echo 1>&2 +cat bear.txt +read -r -n 1 -p "Press any key to run: ./prog bear.txt: " +echo 1>&2 +./prog bear.txt + diff --git a/thanks-for-help.md b/thanks-for-help.md index aa8246a0d..e6b6ca487 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -4306,8 +4306,11 @@ a friend, whether that's real or imagined. ## [2020/endoh2](/2020/endoh2/prog.c) ([README.md](/2020/endoh2/README.md)) -[Cody](#cody) copied the files from the spoiler.zip file that was password protected with -a password that was no longer known from his preview of 2020. +[Cody](#cody) copied the files from the spoiler.zip file (from his copy during +the preview period) that was password protected with a password that was no +longer known. + +He also added the [try.sh](/2020/endoh2/try.sh) script. ## [2020/endoh3](/2020/endoh3/prog.c) ([README.md](/2020/endoh3/README.md))