From e0456a394bae63ff96ec85b402a805b6d7ea2edb Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 19 Dec 2023 09:41:08 -0800 Subject: [PATCH] Improve 1992/gson/try.sh Don't exit if it can't find a 'normal' dictionary file, skipping the creation of one from mkdict.sh. Just use the one generated from mkdict.sh if no other file can be opened (which most likely won't happen but it can happen as not all systems have /usr/share/dict/words and the others are unlikely in modern systems). --- 1992/gson/try.sh | 72 ++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/1992/gson/try.sh b/1992/gson/try.sh index 04c9b17bf..b6c813483 100755 --- a/1992/gson/try.sh +++ b/1992/gson/try.sh @@ -35,49 +35,43 @@ fi # safety check that DICT is not empty and is a readable file # -if [[ -z "$DICT" || ! -f "$DICT" || ! -r "$DICT" ]]; then - echo "No dictionary file found, try specifying one like:" 1>&2 +if [[ -n "$DICT" && -f "$DICT" && -r "$DICT" ]]; then + echo "$ ./ag free software foundation < $DICT" 1>&2 + read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " echo 1>&2 - echo " DICT=dict ./try.sh" 1>&2 + ./ag free software foundation < "$DICT" 2>/dev/null | less -rEXF + + echo "$ ./ag obfuscated c contest < $DICT" 1>&2 + read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " echo 1>&2 - exit 1 + ./ag obfuscated c contest < "$DICT" 2>/dev/null | less -rEXF + + echo "$ ./ag unix international < $DICT" 1>&2 + read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " + echo 1>&2 + ./ag unix international < "$DICT" 2>/dev/null | less -rEXF + + echo "$ ./ag george bush < $DICT" 1>&2 + read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " + echo 1>&2 + ./ag george bush < "$DICT" 2>/dev/null | less -rEXF + + echo "$ ./ag bill clinton < $DICT" 1>&2 + read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " + echo 1>&2 + ./ag bill clinton < "$DICT" 2>/dev/null | less -rEXF + + echo "$ ./ag ross perot < $DICT" 1>&2 + read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " + echo 1>&2 + ./ag ross perot < "$DICT" 2>/dev/null | less -rEXF + + echo "$ ./ag paul e tsongas < $DICT" 1>&2 + read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " + echo 1>&2 + ./ag paul e tsongas < "$DICT" 2>/dev/null | less -rEXF fi -echo "$ ./ag free software foundation < $DICT" 1>&2 -read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " -echo 1>&2 -./ag free software foundation < "$DICT" 2>/dev/null | less -rEXF - -echo "$ ./ag obfuscated c contest < $DICT" 1>&2 -read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " -echo 1>&2 -./ag obfuscated c contest < "$DICT" 2>/dev/null | less -rEXF - -echo "$ ./ag unix international < $DICT" 1>&2 -read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " -echo 1>&2 -./ag unix international < "$DICT" 2>/dev/null | less -rEXF - -echo "$ ./ag george bush < $DICT" 1>&2 -read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " -echo 1>&2 -./ag george bush < "$DICT" 2>/dev/null | less -rEXF - -echo "$ ./ag bill clinton < $DICT" 1>&2 -read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " -echo 1>&2 -./ag bill clinton < "$DICT" 2>/dev/null | less -rEXF - -echo "$ ./ag ross perot < $DICT" 1>&2 -read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " -echo 1>&2 -./ag ross perot < "$DICT" 2>/dev/null | less -rEXF - -echo "$ ./ag paul e tsongas < $DICT" 1>&2 -read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " -echo 1>&2 -./ag paul e tsongas < "$DICT" 2>/dev/null | less -rEXF - # now try making our own dictionary with mkdict.sh: # rm -f words