From 28b03f9d97f82aa1111b2847cf86a6039ca2876f Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 24 Jan 2024 05:09:57 -0800 Subject: [PATCH] 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. --- 1996/gandalf/try.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/1996/gandalf/try.sh b/1996/gandalf/try.sh index b205fca90..01a2054c8 100755 --- a/1996/gandalf/try.sh +++ b/1996/gandalf/try.sh @@ -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