Many improvements to 2005/giljade presentation
The try.sh script lets one experience the entry without having to use vi(m) .. you know, in case they're afraid of getting stuck :-) (and it is easier too). The script leaves the file there (rather than piping to less(1)) so that one can view it in a text editor if they wish. The file test.sh runs the test suite mode but it filters out the running of 'make', instead only showing the lines matching '^Line'. When it's all done it checks if 180 versions (lines) were found (it writes to stdout and another file with tee(1)). If it does not find 180 it is an error and this is reported (with exit 1). If it does find 180 all is good. The make test rule was added and uses this script. Format and typo check README.md file.
This commit is contained in:
1 parent
ea2f4dbb30
commit
a9fbaf593f
5 files changed
+134
-42
No files matched your search
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 2005/giljade
|
||||
#
|
||||
|
||||
# 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 -p "Do you wish to run the test suite (y/n) ? "
|
||||
if [[ "$REPLY" == "y" ]]; then
|
||||
echo "$ make test" 1>&2
|
||||
make test
|
||||
fi
|
||||
|
||||
echo 1>&2
|
||||
echo "$ ./giljade > out" 1>&2
|
||||
./giljade > out
|
||||
echo "For this next step, make sure to keep pressing space (or hold it down) (q = quit)." 1>&2
|
||||
echo "$ less out" 1>&2
|
||||
read -r -n 1 -p "Press any key to continue: "
|
||||
less out
|
||||
|
||||
echo "We've left the file 'out' for you in case you wish to open it in vi(m). If" 1>&2
|
||||
echo "you do we recommend you try holding ctrl-f down in a similar way to how you held" 1>&2
|
||||
echo "down space above. Of course you can open it in another editor if you wish." 1>&2
|
||||
Reference in new issue
Block a user