30 lines
585 B
Bash
Executable File
30 lines
585 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# New Norwegian linter
|
|
|
|
if [ ! `command -v curl &>/dev/null` ]; then
|
|
echo "no curl installation found!" && exit 1
|
|
fi
|
|
|
|
input_file="$(cat $1)"
|
|
|
|
get_page() {
|
|
curl "https://ordbok.uib.no/perl/ordbok.cgi?OPP=$1&ant_bokmaal=5&ant_nynorsk=5&nynorsk=+&ordbok=nynorsk" 2>/dev/null
|
|
}
|
|
|
|
no_errors=1
|
|
|
|
for token in $input_file; do
|
|
word="$(echo $token | sed 's/[\.\,\;\:\!\?]//g')"
|
|
get_page "$word" | grep "class=\"ikkefunnet\"" >/dev/null
|
|
status=$?
|
|
if [ 0 -eq $status ]; then
|
|
echo "word not found: $word"
|
|
no_errors=0
|
|
fi
|
|
done
|
|
|
|
if [ 1 -eq $no_errors ]; then
|
|
echo "all good!"
|
|
fi
|