Improve 1996/schweikh2/try.sh

As I was going through another file I noticed that something was missing
from the script, if perl is installed, and it also prompts the user if
they wish to run the author's suggested command (it results in an
infinite loop which is why it was left out but prompting for it is okay
as it's at the end).

The make clobber rule was updated for this update.
This commit is contained in:
Cody Boone Ferguson committed 2024-05-27 10:24:24 -07:00
1 parent 128b8b74c5
commit b9f72adc4a
4 files changed
+35

No files matched your search

+1
View File
@@ -203,6 +203,7 @@ clean:
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -rf *.dSYM
${RM} -f obfus.c
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
+4
View File
@@ -57,6 +57,10 @@ appropriately. Try:
perl ./hunni.pl < hunni.c
```
NOTE: the [try.sh](%%REPO_URL%%/1996/schweikh2/try.sh) does this if you have
`perl(1)` installed to show how the output is the same as
[schweikh2.c](%%REPO_URL%%/1996/schweikh2/schweikh2.c) itself.
This entry was another crowd pleaser at the IOCCC BOF.
+3
View File
@@ -422,6 +422,9 @@ appropriately. Try:</p>
<pre><code> less hunni.c
perl ./hunni.pl &lt; hunni.c</code></pre>
<p>NOTE: the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/schweikh2/try.sh">try.sh</a> does this if you have
<code>perl(1)</code> installed to show how the output is the same as
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/schweikh2/schweikh2.c">schweikh2.c</a> itself.</p>
<p>This entry was another crowd pleaser at the IOCCC BOF.</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<p>Note: the source must be viewed with tabstop 8. To appreciate the
+27
View File
@@ -29,3 +29,30 @@ read -r -n 1 -p "Press any key to run grep -v '#' schweikh2.c (space = next page
echo 1>&2
grep -v '#' schweikh2.c | less -rEXF
echo 1>&2
PERL="$(type -P perl)"
if [[ -n "$PERL" ]]; then
read -r -n 1 -p "Press any key to run: less hunni.c (space = next page, q = quit): "
echo 1>&2
less -rEXF hunni.c
echo 1>&2
echo "$ perl ./hunni.pl < hunni.c > obfus.c" 1>&2
read -r -n 1 -p "Press any key to obfuscate hunni.c as obfus.c (space = next page, q = quit): "
echo 1>&2
perl ./hunni.pl < hunni.c > obfus.c
read -r -n 1 -p "Press any key to run: diff -s obfus.c schweikh2.c: "
echo 1>&2
diff -s obfus.c schweikh2.c
rm -f obfus.c
fi
read -r -p "Do you want to run the author's suggested command (Y/N)? "
if [[ "$REPLY" = "y" || "$REPLY" = "Y" ]]; then
echo "Warning: this command is an infinite loop. Press ctrl-c or whatever your" 1>&2
echo "intr is to end it." 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
while :; do grep -v '#' schweikh2.c; sleep 2; echo; done
fi