Add 2013/morgan1/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-01-27 11:16:09 -08:00
1 parent b156b37ef0
commit d4783f02e7
3 files changed
+43 -8

No files matched your search

+5 -8
View File
@@ -8,20 +8,17 @@ make
## To use:
```sh
echo "2013/10/03" | ./morgan1
echo "YYYY/MM/DD" | ./morgan1
```
where `YYYY` is the four digit year, `MM` is the two digit month and `DD` is two
digit day of the month.
## Try:
```sh
echo "1985/10/28" | ./morgan1
echo "1996/12/31" | ./morgan1
echo "1986/03/31" | ./morgan1 # Comet Halley (look for 'Ha')
echo "1997/04/01" | ./morgan1 # Comet Hale-Bopp (look for 'Hb')
./try.sh
```
Try pressing the arrow keys when your focus is in the window.
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2013/morgan1
#
# 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: echo 1985/10/28 | ./morgan1: "
echo 1>&2
echo "1985/10/28" | ./morgan1
echo 1>&2
read -r -n 1 -p "Press any key to run: echo 1996/12/31 | ./morgan1: "
echo 1>&2
echo "1996/12/31" | ./morgan1
echo 1>&2
read -r -n 1 -p "Press any key to run: echo 1986/03/31 | ./morgan1 # Comet Halley (look for 'Ha'): "
echo 1>&2
echo "1986/03/31" | ./morgan1 # Comet Halley (look for 'Ha')
echo 1>&2
read -r -n 1 -p "Press any key to run: echo 1997/04/01 | ./morgan1 # Comet Hale-Bopp (look for 'Hb'): "
echo 1>&2
echo "1997/04/01" | ./morgan1 # Comet Hale-Bopp (look for 'Hb')
echo 1>&2
+2
View File
@@ -4052,6 +4052,8 @@ Firefox both had the problem.
[Cody](#cody) added explicit linking of libm (`-lm`) as not all systems do this
implicitly (Linux doesn't seem to but macOS does).
Cody also added the [try.sh](/2013/morgan1/try.sh) script.
## <a name="2013_robison"></a>[2013/robison](/2013/robison/robison.c) ([README.md](/2013/robison/README.md))