Add try.sh to 1985/august
The script has fun with reversing bits too through rev(1) (if installed). The script calls primes.sh even if primes(6) is not installed as that script will check that it's installed and will tell one where to get it if it's not. It only uses the default value, however, so primes.sh is still shown in the README.md file.
This commit is contained in:
1 parent
1743b7a3bd
commit
89c5171c26
4 files changed
+51
-3
No files matched your search
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 1985/august
|
||||
#
|
||||
|
||||
# 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
|
||||
|
||||
REV="$(type -P rev)"
|
||||
PRIMES=$(type -P primes)
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./august | head -n 11: "
|
||||
echo 1>&2
|
||||
./august | head -n 11
|
||||
|
||||
if [[ -n "$REV" ]]; then
|
||||
echo 1>&2
|
||||
read -r -n 1 -p "Press any key to reverse bits: "
|
||||
echo 1>&2
|
||||
./august | head -n 11 | "$REV"
|
||||
fi
|
||||
|
||||
# run primes.sh too
|
||||
echo 1>&2
|
||||
read -r -n 1 -p "Press any key to run: ./primes.sh: "
|
||||
echo 1>&2
|
||||
./primes.sh
|
||||
exit 0
|
||||
Reference in new issue
Block a user