Add 1998/schweikh2/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-01-19 08:28:48 -08:00
1 parent 0bcbcbebc8
commit f9f4e27535
3 files changed
+37 -2

No files matched your search

+3 -2
View File
@@ -21,13 +21,14 @@ or
## Try:
```sh
./yarng 5
./try.sh
./yarng
# watch what it does
```
What is the difference there?
What is the difference between what is in the script and running `yarng` without
an arg?
## Judges' remarks:
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 1998/schweikh2
#
# 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
i=0
while [[ "$i" -lt 3 ]]; do
NUM="$((RANDOM % 10))"
read -r -n 1 -p "Press any key to run: ./yarng $NUM: "
echo 1>&2
./yarng "$NUM"
echo 1>&2
read -r -n 1 -p "Press any key to run: ./yarng $NUM: "
echo 1>&2
./yarng "$NUM"
echo 1>&2
((i++))
done
+2
View File
@@ -2428,6 +2428,8 @@ Cody also added an `int` after `register` in `main()` in case clang decides to
have a problem with that in the future which is not entirely out of the
question.
Cody also added the [try.sh](/1998/schweikh2/try.sh) script.
## <a name="1998_schweikh3"></a>[1998/schweikh3](/1998/schweikh3/schweikh3.c) ([README.md](/1998/schweikh3/README.md]))