Add 2013/endoh1/try.sh + format/typo checks + bugs
The bugs.md file has limitations of the entry added to it. The README.md file was format/typo checked. The try.sh script is as usual. I also added a command to try in the 'try' section that is not in the try.sh script due to it being long output but still fun to try.
This commit is contained in:
1 parent
c5b831f3a0
commit
594b9f32f3
4 files changed
+110
-18
No files matched your search
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 2013/endoh1
|
||||
#
|
||||
|
||||
# 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: less endoh1.c (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
less -EXF endoh1.c
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./endoh1 hello.lazy: "
|
||||
echo 1>&2
|
||||
./endoh1 hello.lazy
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./hello: "
|
||||
echo 1>&2
|
||||
./hello
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo Hello | ./echo: "
|
||||
echo 1>&2
|
||||
# ShellCheck gets this wrong, thinking ./echo is the shell built-in or system
|
||||
# command so we disable the warning.
|
||||
#
|
||||
# ^----^ SC2216 (warning): Piping to 'echo', a command that doesn't read stdin. Did you want 'cat' instead?
|
||||
# shellcheck disable=SC2216
|
||||
echo Hello | ./echo
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./tac < endoh1.c | less (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
./tac < endoh1.c | less -EXF
|
||||
echo 1>&2
|
||||
Reference in new issue
Block a user