Skip to content

Commit

Permalink
Adding a decent error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantinDjairo authored Jun 3, 2023
1 parent 728c80d commit b5e9900
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dictpopup
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/bin/sh

word=${1:-$(sselp)}
sdcv -n --utf8-output -e "$word" | tail -n +5 | perl -pe 's/<[^>]*>//g' | popup

dict_lookup=$(sdcv -n --utf8-output -e "$word")


if echo "$dict_lookup" | perl -0777 -ne 'exit 0 if /Nothing similar to/ ; exit 1'; then
echo "$dict_lookup" | popup

else
echo "$dict_lookup" | tail -n +5 | perl -pe 's/<[^>]*>//g' | popup

fi

0 comments on commit b5e9900

Please sign in to comment.