Improve and shellcheck fix 2012/tromp/try.sh

As for the shellcheck warning could be fixed (missing '\' before a '"')
and the useless cat ones had the rationale updated (it's what the author
used so it's easier to verify it's okay though I still say - and so does
the script - that there's no such thing as a useless cat) and the format
of what warning is disabled (URL included).
This commit is contained in:
Cody Boone Ferguson committed 2024-01-26 10:55:13 -08:00
1 parent 86ee07db36
commit 6f4167373f
1 file changed
+38 -48
+38 -48
View File
@@ -15,106 +15,96 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
# shellcheck disable=SC2140
echo "$ (cat hilbert.Blc; echo -n "1") | ./tromp" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: (cat hilbert.Blc; echo -n \"1\") | ./tromp: "
echo 1>&2
(cat hilbert.Blc; echo -n "1") | ./tromp
echo 1>&2
# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
# shellcheck disable=SC2140
echo "$ (cat hilbert.Blc; echo -n "12") | ./tromp" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: (cat hilbert.Blc; echo -n \"12\") | ./tromp: "
echo 1>&2
(cat hilbert.Blc; echo -n "12") | ./tromp
echo 1>&2
# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
# shellcheck disable=SC2140
echo "$ (cat hilbert.Blc; echo -n "123") | ./tromp" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
# There's no such thing as a useless cat so we silence:
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# There's no such thing as a useless cat so we silence. Well okay it's also
# because it's easier to verify that it works as this form was given by the
# author.
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
read -r -n 1 -p "Press any key to run: (cat hilbert.Blc; echo -n \"123\") | ./tromp: "
echo 1>&2
(cat hilbert.Blc; echo -n "123") | ./tromp
echo 1>&2
echo "$ (cat hilbert.Blc; echo -n 1234) | ./tromp" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: (cat hilbert.Blc; echo -n 1234) | ./tromp: "
echo 1>&2
# There's no such thing as a useless cat so we silence:
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# There's no such thing as a useless cat so we silence. Well okay it's also
# because it's easier to verify that it works as this form was given by the
# author.
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
(cat hilbert.Blc; echo -n 1234) | ./tromp
echo 1>&2
echo "$ echo " Hello, world" | ./tromp"
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: echo \" Hello, world\" | ./tromp: "
echo 1>&2
echo " Hello, world" | ./tromp
echo 1>&2
echo "$ echo "*Hello, world" | ./tromp" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: echo \"*Hello, world\" | ./tromp: "
echo 1>&2
echo "*Hello, world" | ./tromp
echo 1>&2
echo "$ (cat uni8.Blc; echo " Ni hao") | ./tromp" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: (cat uni8.Blc; echo \" Ni hao\") | ./tromp: "
echo 1>&2
# There's no such thing as a useless cat so we silence:
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
#
# shellcheck disable=SC2002
(cat uni8.Blc; echo " Ni hao") | ./tromp
echo 1>&2
echo "$ cat primes.blc | ./tromp -b | head -c 70" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
# There's no such thing as a useless cat so we silence:
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# There's no such thing as a useless cat so we silence. Well okay it's also
# because it's easier to verify that it works as this form was given by the
# author.
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
cat primes.blc | ./tromp -b | head -c 70
echo 1>&2
echo "$ (cat oddindices.Blc; echo -n " "; cat primes.blc | ./tromp -b) | ./tromp | head -c 70" 1>&2
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
# There's no such thing as a useless cat so we silence:
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# There's no such thing as a useless cat so we silence. Well okay it's also
# because it's easier to verify that it works as this form was given by the
# author.
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
(cat oddindices.Blc; echo -n " "; cat primes.blc | ./tromp -b) | ./tromp | head -c 70
echo 1>&2
echo "$ cat hw.bf" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: cat hw.bf: "
echo 1>&2
cat hw.bf
echo 1>&2
echo "$ cat bf.Blc hw.bf | ./tromp" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: cat bf.Blc hw.bf | ./tromp: "
echo 1>&2
# There's no such thing as a useless cat so we silence:
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# There's no such thing as a useless cat so we silence. Well okay it's also
# because it's easier to verify that it works as this form was given by the
# author.
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
cat bf.Blc hw.bf | ./tromp