diff --git a/1990/westley/README.md b/1990/westley/README.md index 0dd814767..6b6e56705 100644 --- a/1990/westley/README.md +++ b/1990/westley/README.md @@ -17,10 +17,7 @@ The number should be greater than 0. ### Try: ```sh -./westley 1 -./westley 2 -./westley 3 -./westley 5 +./try.sh ``` diff --git a/1990/westley/try.sh b/1990/westley/try.sh new file mode 100755 index 000000000..29e8916d6 --- /dev/null +++ b/1990/westley/try.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1990/westley +# + +# 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: ./westley 1: " +echo 1>&2 +./westley 1 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./westley 2: " +echo 1>&2 +./westley 2 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./westley 3: " +echo 1>&2 +./westley 3 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./westley 5: " +echo 1>&2 +./westley 5 +echo 1>&2 diff --git a/thanks-for-help.md b/thanks-for-help.md index 7507f6b7b..ef469ed47 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -1141,6 +1141,8 @@ often be the same (for the purpose of `clang`?). He also fixed the code to not enter an infinite loop if arg is a number not > 0 and to not crash if no arg is specified. +Cody also added the [try.sh](/1990/westley/try.sh) script. + The alt code did NOT have arg checks added as it is actually a copy of the original code.