xref: /minix3/minix/commands/spell/spell.sh (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc#!/bin/sh
2*433d6423SLionel Sambuc#
3*433d6423SLionel Sambuc#	spell 1.1 - show unknown words			Author: Kees J. Bot
4*433d6423SLionel Sambuc#								28 Apr 1995
5*433d6423SLionel Sambuc
6*433d6423SLionel Sambucdict=words
7*433d6423SLionel Sambuc
8*433d6423SLionel Sambucwhile getopts 'd:' opt
9*433d6423SLionel Sambucdo
10*433d6423SLionel Sambuc	case $opt in
11*433d6423SLionel Sambuc	d)	dict="$OPTARG"
12*433d6423SLionel Sambuc		;;
13*433d6423SLionel Sambuc	?)	echo "Usage: spell [-d dict] [file ...]" >&2; exit 1
14*433d6423SLionel Sambuc	esac
15*433d6423SLionel Sambucdone
16*433d6423SLionel Sambucshift `expr $OPTIND - 1`
17*433d6423SLionel Sambuc
18*433d6423SLionel Sambuccase "$dict" in
19*433d6423SLionel Sambuc*/*)	;;
20*433d6423SLionel Sambuc*)	dict="/usr/lib/dict/$dict"
21*433d6423SLionel Sambucesac
22*433d6423SLionel Sambuc
23*433d6423SLionel Sambuc{
24*433d6423SLionel Sambuc	if [ $# = 0 ]
25*433d6423SLionel Sambuc	then
26*433d6423SLionel Sambuc		prep
27*433d6423SLionel Sambuc	else
28*433d6423SLionel Sambuc		for file
29*433d6423SLionel Sambuc		do
30*433d6423SLionel Sambuc			prep "$file"
31*433d6423SLionel Sambuc		done
32*433d6423SLionel Sambuc	fi
33*433d6423SLionel Sambuc} | {
34*433d6423SLionel Sambuc	sort -u | comm -23 - "$dict"
35*433d6423SLionel Sambuc}
36