Further improvements to 1996/gandalf/try.sh

Running ./try.sh by itself will not show this improvement. It might be
an inside joke between Landon and me but which adds fun to the entry in
a way that many people will appreciate, given the entry name. Those who
do not, however, will not be bothered by it as running ./try.sh won't do
anything different from before: it'll just run the program in a variety
of ways as before.
This commit is contained in:
Cody Boone Ferguson committed 2024-01-24 05:09:57 -08:00
1 parent 305361c003
commit 28b03f9d97
1 file changed
+15
+15
View File
@@ -18,6 +18,21 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
if [[ "$#" -gt 0 ]]; then
if [[ "${1@L}" = "gandalf" ]]; then
echo "It is perilous to try the patience of Gandalf!" 1>&2
read -r -p "Are you sure you wish to do this (Y/N)? "
echo 1>&2
if [[ "$REPLY" != "y" && "$REPLY" != "Y" ]]; then
echo "Wise move, will not try Gandalf's patience!" 1>&2
exit 0
else
echo "Fool of a ${USER@u}!" 1>&2
echo 1>&2
fi
fi
fi
# remove temporary files to show later
rm -f hatcat.txt cathat.txt hatcat2.txt cathat2.txt hatcat3.txt cathat3.txt