Add 1990/westley/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-01-12 09:59:23 -08:00
1 parent 2bdf97ec41
commit 36c9def8ac
3 files changed
+39 -4

No files matched your search

+1 -4
View File
@@ -17,10 +17,7 @@ The number should be greater than 0.
### Try:
```sh
./westley 1
./westley 2
./westley 3
./westley 5
./try.sh
```
+36
View File
@@ -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