Add 1986/stein/stein.sh

This script runs the two commands suggested in order to get it to output
cleanly. It is suggested other systems might need another set of
characters but one can also get away with just using ./stein so this is
also done but at the end of the script to not cause any problems (it
doesn't show a newline at output).
This commit is contained in:
Cody Boone Ferguson committed 2023-12-28 07:54:32 -08:00
1 parent 8c4fe6dbdd
commit 1920ca72d8
3 files changed
+29 -1

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ into 3 lines. Join all lines into a single line to recreate
the original file. 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 One some machines, a control-M control-N arg is needed
to get the command to output cleanly: to get the command to output cleanly:
+25
View File
@@ -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
+3
View File
@@ -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 avoid problems with news and mail but as it was the 'Best one liner' it is now
one line. 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.
## <a name="1986_wall"></a>[1986/wall](/1986/wall/wall.c) ([README.md](/1986/wall/README.md])) ## <a name="1986_wall"></a>[1986/wall](/1986/wall/wall.c) ([README.md](/1986/wall/README.md]))