diff --git a/2012/omoikane/try.alt.sh b/2012/omoikane/try.alt.sh index 4aaf26b65..8111748a6 100755 --- a/2012/omoikane/try.alt.sh +++ b/2012/omoikane/try.alt.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# try.sh - demonstrate IOCCC winner 2012/omoikane alternate code +# try.alt.sh - demonstrate IOCCC winner 2012/omoikane alt code # # make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it @@ -10,7 +10,7 @@ if [[ -z "$CC" ]]; then CC="cc" fi -make CC="$CC" everything >/dev/null || exit 1 +make CC="$CC" alt >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear @@ -23,27 +23,29 @@ PERL="$(type -P perl)" echo "$ echo \"A quick brown fox jumps over the lazy dog\" | ./nyaruko.alt > output.c" 1>&2 echo "A quick brown fox jumps over the lazy dog" | ./nyaruko.alt > output.c -read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): " +read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): " echo 1>&2 -less -EX output.c +less -rEXFK output.c # perl specific stuff -if [[ -n "$PERL" ]]; then +if [[ -n "$PERL" && -f "$PERL" && -x "$PERL" ]]; then read -r -n 1 -p "Press any key to run: ${PERL} output.c > data.c: " 1>&2 echo 1>&2 "${PERL}" output.c > data.c - read -r -n 1 -p "Press any key to run: less -EX data.c (space = next page, q = quit): " + read -r -n 1 -p "Press any key to show data.c (space = next page, q = quit): " + echo 1>&2 + less -rEXFK data.c + echo 1>&2 + read -r -n 1 -p "Press any key to run: cc -o data data.c: " echo 1>&2 - less -EX data.c - echo "$ cc -o data data.c" 1>&2 cc -o data data.c read -r -n 1 -p "Press any key to run: ./data: " - echo "$ ./data" 1>&2 echo 1>&2 ./data fi -echo "$ cc -o output output.c" 1>&2 +read -r -n 1 -p "Press any key to run: cc -o output output.c: " +echo 1>&2 cc -o output output.c read -r -n 1 -p "Press any key to run: ./output: " echo 1>&2 @@ -53,37 +55,41 @@ echo "$ ./output" 1>&2 read -r -n 1 -p "Press any key to run: ./nyaruko.alt < output > output.c: " echo 1>&2 ./nyaruko.alt < output > output.c -read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): " +read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): " echo 1>&2 -less -EX output.c +less -rEXFK output.c read -r -n 1 -p "Press any key to run: bash output.c > key.c: " +echo 1>&2 bash output.c > key.c echo 1>&2 -read -r -n 1 -p "Press any key to run: less -EX key.c (space = next page, q = quit): " -less -EX key.c +read -r -n 1 -p "Press any key to run: show key.c (space = next page, q = quit): " +less -rEXFK key.c # more perl stuff -if [[ -n "${PERL}" ]]; then +if [[ -n "${PERL}" && -f "$PERL" && -x "$PERL" ]]; then read -r -n 1 -p "Press any key to run: ${PERL} output.c > data.c: " echo 1>&2 "${PERL}" output.c > data.c - read -r -n 1 -p "Press any key to run: less -EX data.c (space = next page, q = quit): " + read -r -n 1 -p "Press any key to show data.c (space = next page, q = quit): " echo 1>&2 - less -EX data.c + less -rEXFK data.c read -r -n 1 -p "Press any key to run: cat key.c data.c > output.c: " echo 1>&2 cat key.c data.c > output.c - read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): " + read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): " + echo 1>&2 + less -rEXFK output.c + read -r -n 1 -p "Press any key to run: cc output.c -o output: " echo 1>&2 - less -EX output.c - echo "$ cc output.c -o output" 1>&2 cc output.c -o output read -r -n 1 -p "Press any key to run: ./output > output.2: " echo 1>&2 ./output > output.2 - echo "$ chmod +x output.2" 1>&2 + read -r -n 1 -p "Press any key to run: chmod +x output.2: " + echo 1>&2 chmod +x output.2 read -r -n 1 -p "Press any key to run: ./output.2: " + echo 1>&2 ./output.2 fi diff --git a/2012/omoikane/try.sh b/2012/omoikane/try.sh index 6778a1faf..962e4b42b 100755 --- a/2012/omoikane/try.sh +++ b/2012/omoikane/try.sh @@ -23,27 +23,29 @@ PERL="$(type -P perl)" echo "$ echo \"A quick brown fox jumps over the lazy dog\" | ./nyaruko > output.c" 1>&2 echo "A quick brown fox jumps over the lazy dog" | ./nyaruko > output.c -read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): " +read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): " echo 1>&2 -less -EX output.c +less -rEXFK output.c # perl specific stuff -if [[ -n "$PERL" ]]; then +if [[ -n "$PERL" && -f "$PERL" && -x "$PERL" ]]; then read -r -n 1 -p "Press any key to run: ${PERL} output.c > data.c: " 1>&2 echo 1>&2 "${PERL}" output.c > data.c - read -r -n 1 -p "Press any key to run: less -EX data.c (space = next page, q = quit): " + read -r -n 1 -p "Press any key to show data.c (space = next page, q = quit): " + echo 1>&2 + less -rEXFK data.c + echo 1>&2 + read -r -n 1 -p "Press any key to run: cc -o data data.c: " echo 1>&2 - less -EX data.c - echo "$ cc -o data data.c" 1>&2 cc -o data data.c read -r -n 1 -p "Press any key to run: ./data: " - echo "$ ./data" 1>&2 echo 1>&2 ./data fi -echo "$ cc -o output output.c" 1>&2 +read -r -n 1 -p "Press any key to run: cc -o output output.c: " +echo 1>&2 cc -o output output.c read -r -n 1 -p "Press any key to run: ./output: " echo 1>&2 @@ -53,37 +55,41 @@ echo "$ ./output" 1>&2 read -r -n 1 -p "Press any key to run: ./nyaruko < output > output.c: " echo 1>&2 ./nyaruko < output > output.c -read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): " +read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): " echo 1>&2 -less -EX output.c +less -rEXFK output.c read -r -n 1 -p "Press any key to run: bash output.c > key.c: " +echo 1>&2 bash output.c > key.c echo 1>&2 -read -r -n 1 -p "Press any key to run: less -EX key.c (space = next page, q = quit): " -less -EX key.c +read -r -n 1 -p "Press any key to run: show key.c (space = next page, q = quit): " +less -rEXFK key.c # more perl stuff -if [[ -n "${PERL}" ]]; then +if [[ -n "${PERL}" && -f "$PERL" && -x "$PERL" ]]; then read -r -n 1 -p "Press any key to run: ${PERL} output.c > data.c: " echo 1>&2 "${PERL}" output.c > data.c - read -r -n 1 -p "Press any key to run: less -EX data.c (space = next page, q = quit): " + read -r -n 1 -p "Press any key to show data.c (space = next page, q = quit): " echo 1>&2 - less -EX data.c + less -rEXFK data.c read -r -n 1 -p "Press any key to run: cat key.c data.c > output.c: " echo 1>&2 cat key.c data.c > output.c - read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): " + read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): " + echo 1>&2 + less -rEXFK output.c + read -r -n 1 -p "Press any key to run: cc output.c -o output: " echo 1>&2 - less -EX output.c - echo "$ cc output.c -o output" 1>&2 cc output.c -o output read -r -n 1 -p "Press any key to run: ./output > output.2: " echo 1>&2 ./output > output.2 - echo "$ chmod +x output.2" 1>&2 + read -r -n 1 -p "Press any key to run: chmod +x output.2: " + echo 1>&2 chmod +x output.2 read -r -n 1 -p "Press any key to run: ./output.2: " + echo 1>&2 ./output.2 fi diff --git a/thanks-for-help.md b/thanks-for-help.md index b423c0995..945e3ef32 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3820,17 +3820,15 @@ respectively. Notice how a single letter changes so much! ## [2012/omoikane](/2012/omoikane/omoikane.c) ([README.md](/2012/omoikane/README.md])) -[Cody](#cody) added the [try.sh](/2012/omoikane/try.sh) script. - -Cody also added the [alternate code](/2012/omoikane/README.md#alternate-code) +[Cody](#cody) added the [alternate versions](/2012/omoikane/README.md#alternate-code) which will, if no arg is specified, read in the program itself, rather than `/dev/urandom`. This is mostly useful for those without a `/dev/urandom` device file (the default for the entry). The second alternate version is like the first except that it also sets binary mode on `stdin` and `stdout` which should theoretically make it work in Windows. -Cody also added the [try.alt.sh](/2012/omoikane/try.alt.sh) script that is like -the `try.sh` script but which uses the (first version of the) alt code instead. +Cody also added the [try.sh](/2012/omoikane/try.sh) and +[try.alt.sh](/2012/omoikane/try.alt.sh) scripts. ## [2012/tromp](/2012/tromp/tromp.c) ([README.md](/2012/tromp/README.md))