summaryrefslogtreecommitdiff
path: root/dictloop
diff options
context:
space:
mode:
Diffstat (limited to 'dictloop')
-rwxr-xr-xdictloop21
1 files changed, 21 insertions, 0 deletions
diff --git a/dictloop b/dictloop
new file mode 100755
index 0000000..6e9735b
--- /dev/null
+++ b/dictloop
@@ -0,0 +1,21 @@
+#!/usr/bin/zsh
+
+setopt aliases
+source "$ZDOTDIR/aliasrc"
+
+[ "$#" -ne 1 ] && { echo "Usage: dictloop <dict>" >&2; exit 1; }
+dict="$1" # a command-line dictionary
+
+while true; do
+ echo "Enter a word: "
+ read -r word
+
+ if [ -z "$word" ] || [ "$word" = "exit" ]; then
+ echo "Exiting..."
+ exit 0
+ fi
+
+ "$dict" "$word"
+done
+
+exit 0