summaryrefslogtreecommitdiff
path: root/dictloop
blob: 23ba1b0de72e3c4c60fb2ed05399f72fee5b8955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# Script for checking multiple definitions one after another

# Argument check
if [ "$#" -ne 1 ]; then
	echo "Usage: dictloop <dict>" >&2
	exit 1
fi

dict=$1

while :; do
	printf "Enter a word: "
	read -r word

	if [ -z "$word" ] || [ "$word" = "exit" ]; then
		echo "Exiting..."
		exit 0
	fi

	"$dict" "$word"
done