commit 14cb90b1a4ec29569dab46221163eca418d56f36 parent 4bd790f376a0165450515eeaabd4bb6c8f20007a Author: hhvn <dev@hhvn.uk> Date: Sun, 15 May 2022 20:55:13 +0100 dict command: print error if term does not exist Diffstat:
M | bin/dict | | | 14 | ++++++++------ |
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/bin/dict b/bin/dict @@ -1,7 +1,9 @@ -#!/bin/sh +#!/bin/rc -# -# file=$(mktemp /var/gopher/paste/XXXXXXXX) -# curl "dict://dict.org/d:$@" | tr -d '\r' | grep -v '^[0-9]' | head -n -1 > $file -# echo "gopher://hlirc.net/0/paste/$(basename $file)" -echo "dict://dict.org/d:$*" +uri = 'dict://dict.org/d:' ^ $^* + +if (curl $uri | grep 'no match' >/dev/null) { + echo 'No match' +} else { + echo $uri +}