cli-scripts/scripts/def

17 lines
483 B
Bash
Executable File

#!/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