Merge pull request #1804 from xexyl/stein86-sh

Add 1986/stein/stein.sh
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-12-28 19:03:32 -08:00
commit ee05ddf836
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 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:
+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
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]))