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).
This commit is contained in:
Cody Boone Ferguson committed 2023-12-19 09:41:08 -08:00
1 parent a673c74b92
commit e0456a394b
1 file changed
+2 -8
+2 -8
View File
@@ -35,14 +35,7 @@ fi
# safety check that DICT is not empty and is a readable file # safety check that DICT is not empty and is a readable file
# #
if [[ -z "$DICT" || ! -f "$DICT" || ! -r "$DICT" ]]; then if [[ -n "$DICT" && -f "$DICT" && -r "$DICT" ]]; then
echo "No dictionary file found, try specifying one like:" 1>&2
echo 1>&2
echo " DICT=dict ./try.sh" 1>&2
echo 1>&2
exit 1
fi
echo "$ ./ag free software foundation < $DICT" 1>&2 echo "$ ./ag free software foundation < $DICT" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2 echo 1>&2
@@ -77,6 +70,7 @@ echo "$ ./ag paul e tsongas < $DICT" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2 echo 1>&2
./ag paul e tsongas < "$DICT" 2>/dev/null | less -rEXF ./ag paul e tsongas < "$DICT" 2>/dev/null | less -rEXF
fi
# now try making our own dictionary with mkdict.sh: # now try making our own dictionary with mkdict.sh:
# #