New: udct.sh
This commit is contained in:
commit
f368c89fff
|
@ -0,0 +1,5 @@
|
|||
# scripts
|
||||
|
||||
|Script|Description|Dependencies|
|
||||
|-|-|-|
|
||||
|[udct.sh](udct.sh)|Query a term at https://urbandictionary.com from commnd line|[jq](https://stedolan.github.io/jq)|
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z "$@" ]; then >&2 echo "Usage: $0 word"; exit 1; fi
|
||||
if [ -z "`which jq`" ]; then
|
||||
exec >&2
|
||||
echo "$0: require jq"
|
||||
echo "$0: check https://stedolan.github.io/jq"
|
||||
fi
|
||||
|
||||
curl -Ls https://api.urbandictionary.com/v0/define?term="$1"\
|
||||
| jq '.list[0].definition'\
|
||||
| awk '{ gsub(/("|\[|\]|\\r)/, ""); gsub(/\\n/, "\n"); print }'\
|
||||
| fmt -w 80
|
Loading…
Reference in New Issue