cleanup def and cecho
This commit is contained in:
parent
c2099140aa
commit
4ea9d9198f
@ -74,10 +74,11 @@ function cecho(){
|
||||
On_ICyan='\033[0;106m' # Cyan
|
||||
On_IWhite='\033[0;107m' # White
|
||||
|
||||
NC="\033[0m" # No Color
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# printf "${(P)1}${2} ${NC}\n" # <-- zsh
|
||||
printf "${!1}${!2}${3} ${NC}\n" # <-- bash
|
||||
msg=${3%%*( )}
|
||||
printf "${!1}${!2}${msg}" && printf "${NC}" && printf "\n" # <-- bash
|
||||
}
|
||||
|
||||
if [ -z "$1" ]
|
||||
|
16
scripts/def
Executable file
16
scripts/def
Executable file
@ -0,0 +1,16 @@
|
||||
#!/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
|
||||
|
Loading…
Reference in New Issue
Block a user