Add 2019/burton/try.sh and other fixes/updates
The try.sh runs prog and wc side by side but in a way that is formatted (including alignment) so it's easier to see what line is from which program and it also runs make test. The script cow was renamed cow.sh to help browsers with whether or not to display or download. The script check was renamed check.sh to help browsers with whether or not to display or download. The script check.sh was fixed in case the 'x' (passed in to the script as an environmental variable) is not executable (it resets it back to ./prog) and also made to satisfy ShellCheck. The script cow.sh was fixed for ShellCheck moo (or was it too? :-) ).
This commit is contained in:
1 parent
ae420f7b32
commit
00b9181b11
12 files changed
+136
-55
No files matched your search
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 2019/burton
|
||||
#
|
||||
|
||||
# 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
|
||||
|
||||
echo "$ cat prog.c" 1>&2
|
||||
cat prog.c
|
||||
echo 1>&2
|
||||
|
||||
for i in prog.c Makefile README.md; do
|
||||
echo "$ ./prog < $i && wc < $i" 1>&2
|
||||
printf "prog: %s\n%4s: %s\n\n" "$(./prog < "$i"|tr -s ' ')" "wc" "$(wc "$i" | tr -s ' ')"
|
||||
done
|
||||
echo 1>&2
|
||||
|
||||
echo "$ make test" 1>&2
|
||||
make test
|
||||
Reference in new issue
Block a user