Add 2004/anonymous/try.sh
This commit is contained in:
1 parent
8070711ef9
commit
379e585e0f
3 files changed
+65
-7
No files matched your search
@@ -22,14 +22,11 @@ images.
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
|
||||
ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm
|
||||
|
||||
./anonymous "My Precious. Yes, my Precious." > precious.pgm
|
||||
./try.sh
|
||||
```
|
||||
|
||||
NOTE: technically the text is supposed to be in all lower case but the above
|
||||
still works for demonstration purposes.
|
||||
NOTE: technically the text is supposed to be in all lower case but the script
|
||||
does use some upper case letters for demonstration purposes.
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
@@ -55,13 +52,14 @@ Hobbit](https://tolkiengateway.net/wiki/The_History_of_The_Hobbit).
|
||||
|
||||
p.s. Frodo lives!
|
||||
|
||||
|
||||
### An important aside :-)
|
||||
|
||||
BTW: if you haven't read [The Lord of the
|
||||
Rings](https://en.wikipedia.org/wiki/The_Lord_of_the_Rings) what are you waiting for? :-)
|
||||
You'll find out the source of the text above though you'll see that there are
|
||||
some circumflexes missing! That's okay though due to I/O of the entry and in
|
||||
earlier drafts sometimes the û with an umlaut had no umlaut but H after the `u`
|
||||
earlier drafts sometimes the û had no diacritic but H after the `u` in
|
||||
it. The real text is:
|
||||
|
||||
> Ash nazg durbatulûk, ash nazg gimbatul, ash nazg thrakatulûk, agh
|
||||
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 2001/anonymous
|
||||
#
|
||||
|
||||
# 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
|
||||
|
||||
# see if we have convert(1)
|
||||
#
|
||||
CONVERT="$(type -P convert)"
|
||||
|
||||
echo "$ ./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
|
||||
ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm" 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to continue: "
|
||||
echo 1>&2
|
||||
./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
|
||||
ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm
|
||||
|
||||
if [[ -n "$CONVERT" ]]; then
|
||||
"$CONVERT" ring.pgm ring.jpg
|
||||
echo "Now open ring.jpg in a graphics viewer, editor or web browser." 1>&2
|
||||
echo "If you don't recognise it you should read The Lord of the Rings" 1>&2
|
||||
echo "immediately. Don't worry! It's not that long. It's only 1031 pages," 1>&2
|
||||
echo "my Precious, yes. :-)" 1>&2
|
||||
else
|
||||
echo "Now open ring.pgm in a graphics viewer capable of reading Netpbm graphics." 1>&2
|
||||
echo "Alternatively, install ImageMagick and try running this script again." 1>&2
|
||||
echo "Once you've done so, if you don't recognise this image, you should read The" 1>&2
|
||||
echo "Lord of the Rings immediately. Don't worry! It's not that long. It's only 1031" 1>&2
|
||||
echo "pages, my Precious, yes. :-)" 1>&2
|
||||
fi
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./anonymous \"My Precious. Yes, my Precious.\" > precious.pgm: "
|
||||
echo 1>&2
|
||||
./anonymous "My Precious. Yes, my Precious." > precious.pgm
|
||||
|
||||
if [[ -n "$CONVERT" ]]; then
|
||||
"$CONVERT" precious.pgm precious.jpg
|
||||
echo "Now open precious.jpg in a graphics viewer, editor or web browser." 1>&2
|
||||
else
|
||||
echo "Now open precious.pgm in a graphics viewer capable of reading Netpbm graphics." 1>&2
|
||||
echo "Alternatively, install ImageMagick and try running this script again." 1>&2
|
||||
fi
|
||||
@@ -2923,6 +2923,11 @@ described in the README.md, based on the author's remarks.
|
||||
# <a name="2004"></a>2004
|
||||
|
||||
|
||||
## <a name="2004_anonymous"></a>[2004/anonymous](/2004/anonymous/anonymous.c) ([README.md](/2004/anonymous/README.md]))
|
||||
|
||||
[Cody](#cody) added the [try.sh](/2004/anonymous/try.sh) script.
|
||||
|
||||
|
||||
## <a name="2004_arachnid"></a>[2004/arachnid](/2004/arachnid/arachnid.c) ([README.md](/2004/arachnid/README.md]))
|
||||
|
||||
[Cody](#cody) added an [alternate version](/2004/arachnid/README.md#alternate-code) which
|
||||
|
||||
Reference in new issue
Block a user