Add 1995/savastio/try.sh and update bugs.md
The try.sh script demonstrates both positive numbers and input that is not a number at all (comparing two different strings). The bugs.md has a new INABIAF - negative numbers will hang the program. It is not clear if another version should be added to gracefully handle this but that can be decided another time. It is not a documented feature so it might be called a bug to fix.
This commit is contained in:
1 parent
3463d79557
commit
0a4af08ac9
6 files changed
+84
-3
No files matched your search
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 1995/savastio
|
||||
#
|
||||
|
||||
# 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 42 | ./savastio: "
|
||||
echo 1>&2
|
||||
echo 42 | ./savastio
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo 24 | ./savastio: "
|
||||
echo 1>&2
|
||||
echo 24 | ./savastio
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo 6 | ./savastio: "
|
||||
echo 1>&2
|
||||
echo 6 | ./savastio
|
||||
echo 1>&2
|
||||
|
||||
rm -f foo.txt
|
||||
read -r -n 1 -p "Press any key to run: echo foo | ./savastio | tee foo.txt: "
|
||||
echo 1>&2
|
||||
echo foo | ./savastio | tee foo.txt
|
||||
echo 1>&2
|
||||
|
||||
rm -f bar.txt
|
||||
read -r -n 1 -p "Press any key to run: echo bar | ./savastio | tee bar.txt: "
|
||||
echo 1>&2
|
||||
echo bar | ./savastio | tee bar.txt
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to show the diff of foo.txt and bar.txt: "
|
||||
echo 1>&2
|
||||
diff -s foo.txt bar.txt
|
||||
echo 1>&2
|
||||
rm foo.txt bar.txt
|
||||
Reference in new issue
Block a user