Add 1998/schweikh2/try.sh
This commit is contained in:
1 parent
0bcbcbebc8
commit
f9f4e27535
3 files changed
+37
-2
No files matched your search
@@ -21,13 +21,14 @@ or
|
|||||||
## Try:
|
## Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./yarng 5
|
./try.sh
|
||||||
|
|
||||||
./yarng
|
./yarng
|
||||||
# watch what it does
|
# 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:
|
## Judges' remarks:
|
||||||
|
|||||||
Executable
+32
@@ -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
|
||||||
@@ -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
|
have a problem with that in the future which is not entirely out of the
|
||||||
question.
|
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]))
|
## <a name="1998_schweikh3"></a>[1998/schweikh3](/1998/schweikh3/schweikh3.c) ([README.md](/1998/schweikh3/README.md]))
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user