diff --git a/1986/stein/README.md b/1986/stein/README.md index c6c1a5ce4..b3a65a8e0 100644 --- a/1986/stein/README.md +++ b/1986/stein/README.md @@ -19,7 +19,7 @@ into 3 lines. Join all lines into a single line to recreate the original file. -The 015 in the above printf command produces a control-N. +The `\015` in the above `printf(1)` command produces a control-N. One some machines, a control-M control-N arg is needed to get the command to output cleanly: diff --git a/1986/stein/stein.sh b/1986/stein/stein.sh new file mode 100755 index 000000000..ea144dc53 --- /dev/null +++ b/1986/stein/stein.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1986/stein +# + +# 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 "$ ./stein \$(printf \"\\015\\015\"); echo" 1>&2 +./stein $(printf "\015\015"); echo + +echo "$ ./stein \$(printf \"\\014\\015\"); echo" 1>&2 +./stein $(printf "\014\015"); echo + +echo "$ ./stein" 1>&2 +./stein diff --git a/thanks-for-help.md b/thanks-for-help.md index c5af8919b..cc9789391 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -406,6 +406,9 @@ being longer (in 1986 a one liner could be longer) was split to three lines to avoid problems with news and mail but as it was the 'Best one liner' it is now one line. +Cody also added the [stein.sh](/1986/stein/stein.sh) script which runs the two +commands that we suggest in order to get it to show clean output. + ## [1986/wall](/1986/wall/wall.c) ([README.md](/1986/wall/README.md]))