Add 1990/westley/try.sh
This commit is contained in:
1 parent
2bdf97ec41
commit
36c9def8ac
3 files changed
+39
-4
No files matched your search
@@ -17,10 +17,7 @@ The number should be greater than 0.
|
|||||||
### Try:
|
### Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./westley 1
|
./try.sh
|
||||||
./westley 2
|
|
||||||
./westley 3
|
|
||||||
./westley 5
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Executable
+36
@@ -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
|
||||||
@@ -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
|
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.
|
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
|
The alt code did NOT have arg checks added as it is actually a copy of the
|
||||||
original code.
|
original code.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user