summaryrefslogtreecommitdiff
path: root/dictloop
diff options
context:
space:
mode:
authorfilip <“filip.rabiega@gmail.com”>2026-01-21 10:36:12 +0100
committerfilip <“filip.rabiega@gmail.com”>2026-01-21 10:36:12 +0100
commit88f0243428c4cf39029c8ffc5a7e1634951158a0 (patch)
treef8b05b9f056dd72b7955f90560c453b4c317bd92 /dictloop
parent83954961af8b6337da100e038561f2fd975ac1fe (diff)
downloadchadscripts-88f0243428c4cf39029c8ffc5a7e1634951158a0.tar.gz
chadscripts-88f0243428c4cf39029c8ffc5a7e1634951158a0.tar.bz2
chadscripts-88f0243428c4cf39029c8ffc5a7e1634951158a0.zip
add comments to some scripts
Diffstat (limited to 'dictloop')
-rwxr-xr-xdictloop23
1 files changed, 13 insertions, 10 deletions
diff --git a/dictloop b/dictloop
index 738b3c0..1a239ea 100755
--- a/dictloop
+++ b/dictloop
@@ -1,16 +1,21 @@
-#!/usr/bin/zsh
+#!/bin/sh
+# Script for checking multiple definitions one after another
-setopt aliases
-source "$ZDOTDIR/aliasrc"
+# Load aliases if available
+if [ -n "$ZDOTDIR" ] && [ -f "$ZDOTDIR/aliasrc" ]; then
+ . "$ZDOTDIR/aliasrc"
+fi
-[ "$#" -ne 1 ] && {
+# Argument check
+if [ "$#" -ne 1 ]; then
echo "Usage: dictloop <dict>" >&2
exit 1
-}
-dict="$1" # a command-line dictionary
+fi
-while true; do
- echo "Enter a word: "
+dict=$1
+
+while :; do
+ printf "Enter a word: "
read -r word
if [ -z "$word" ] || [ "$word" = "exit" ]; then
@@ -20,5 +25,3 @@ while true; do
"$dict" "$word"
done
-
-exit 0