Add 1996/schweikh1/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-01-19 05:38:26 -08:00
1 parent 1de404c42b
commit e88b19a307
3 files changed
+33 -4

No files matched your search

+3 -2
View File
@@ -14,10 +14,11 @@ make all
## Try:
To find the day that Easter falls on in the current year:
To find the day that Easter falls on in the current year and to show all Easter
dates from 1582 to 2199:
```sh
./schweikh1 |grep $(date +%Y)
./try.sh
```
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
#
# try.sh - show IOCCC winner 1996/schweikh1
#
# 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 show date of Easter this year (./schweikh1 |grep \$(date +%Y)): "
echo 1>&2
./schweikh1 |grep "$(date +%Y)"
echo 1>&2
read -r -n 1 -p "Press any key to show Easter dates from 1582 to 2199 (space = next page, q = quit): "
echo 1>&2
./schweikh1 | less -rEXF
echo 1>&2