cli-scripts/scripts/def

17 lines
487 B
Plaintext
Raw Normal View History

2024-03-01 11:46:09 +00:00
#!/usr/bin/env bash
mkdir -p ${HOME}/.local/tmp
dict -h localhost -d gcide "$@" > ${HOME}/.local/tmp/"${1}".txt 2>&1
content=$(cat ${HOME}/.local/tmp/"${1}".txt);
rm ${HOME}/.local/tmp/${1}.txt
if [[ "${content}" == *"No definitions found"* ]]; then
#./cecho IYellow On_Blue "$(cat ${HOME}/.local/tmp/${1}.txt)"
./cecho IYellow On_Black "${content%%*( )}"
else
#./cecho Black On_White "$(cat ${HOME}/.local/tmp/${1}.txt)"
./cecho IWhite On_Black "${content%%*()}"
fi