From 2d4b008d002d99ea0912457e25e83dd6ce80cfa8 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:53:45 -0800 Subject: [PATCH] Improve 2006/hamre/try.sh --- 2006/hamre/try.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/2006/hamre/try.sh b/2006/hamre/try.sh index fe123581b..453b5fd25 100755 --- a/2006/hamre/try.sh +++ b/2006/hamre/try.sh @@ -17,17 +17,18 @@ clear -echo "$ ./hamre '-1*42/3*(42*42*42)/42'" 1>&2 +read -r -n 1 -p "Press any key to run: ./hamre '-1*42/3*(42*42*42)/42': " +echo 1>&2 ./hamre '-1*42/3*(42*42*42)/42' echo 1>&2 -read -r -n 1 -p "Press any key to continue: " -echo "$ ./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2'" 1>&2 +read -r -n 1 -p "Press any key to run: ./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2': " +echo 1>&2 ./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2' echo 1>&2 -read -r -n 1 -p "Press any key to continue: " -echo "$ ./hamre '1/0' 1>&2" 1>&2 +read -r -n 1 -p "Press any key to run: ./hamre '1/0': " +echo 1>&2 ./hamre '1/0' 1>&2 echo 1>&2 echo "...why did you not get an answer?" 1>&2 @@ -37,21 +38,33 @@ LIFE=12 UNIVERSE=15 EVERYTHING=15 read -r -n 1 -p "Press any key to continue: " +echo 1>&2 echo "For the next two notice how similar they are: why do they give different answers?" 1>&2 echo "$ LIFE=12; UNIVERSE=15; EVERYTHING=15; ./hamre \"\$LIFE/\$UNIVERSE/\$EVERYTHING\"" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 ./hamre "$LIFE/$UNIVERSE/$EVERYTHING" +echo 1>&2 echo "$ LIFE=12; UNIVERSE=15; EVERYTHING=15; ./hamre \"\$LIFE / \$UNIVERSE / \$EVERYTHING\"" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 ./hamre "$LIFE / $UNIVERSE / $EVERYTHING" echo 1>&2 read -r -n 1 -p "Press any key to continue: " +echo 1>&2 echo "And why do these next two give different answers?" 1>&2 echo "$ LIFE=12; UNIVERSE=15; EVERYTHING=15; ./hamre \"\$LIFE + \$UNIVERSE + \$EVERYTHING\"" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 ./hamre "$LIFE + $UNIVERSE + $EVERYTHING" echo "$ LIFE=12; UNIVERSE=15; EVERYTHING=15; ./hamre \"\$LIFE+\$UNIVERSE+\$EVERYTHING\"" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 ./hamre "$LIFE+$UNIVERSE+$EVERYTHING" +echo 1>&2 echo "As it turns out, \$LIFE+\$UNIVERSE+\$EVERYTHING == 42/1 == 42!" 1>&2