From 5466fa5fcd10063f512172b633e5d0fa18505b17 Mon Sep 17 00:00:00 2001 From: Holger Sielaff Date: Sun, 26 Oct 2025 21:52:57 +0100 Subject: [PATCH] added colors --- .bashaliases | 2 ++ colors.sh | 44 +++++++++++++++++++++++ deb-src/etc/cron.daily/tmp-garbage-job.sh | 5 +++ 3 files changed, 51 insertions(+) create mode 100755 colors.sh create mode 100644 deb-src/etc/cron.daily/tmp-garbage-job.sh diff --git a/.bashaliases b/.bashaliases index af1fd7a..9b0628d 100644 --- a/.bashaliases +++ b/.bashaliases @@ -19,3 +19,5 @@ alias -- -="cd -" shopt -s autocd shopt -s cdspell +# source $HOME/.local/lib/colors.sh + diff --git a/colors.sh b/colors.sh new file mode 100755 index 0000000..41f5227 --- /dev/null +++ b/colors.sh @@ -0,0 +1,44 @@ +colors() { + for i in {31..38}; do + echo -ne "\e[${i}m" + if [[ "${@}" =~ -f ]]; then + echo "color_$i() {" + echo " echo -e \"\\e[${i}m\${@}\\e[0m\"" + echo "}" + else + echo $i + fi + echo -ne "\e[0m" + done +} + +colored(){ + declare -A local _colored=(["red"]=31 ["brown"]=33 ["blue"]=34 ["magenta"]=35 ["log"]=36 ["light"]=37) + local _keys="^$(echo "${!_colored[@]}" | sed 's/ /|/g')$" + if [[ "$1" =~ $_keys ]]; then + _color="${_colored[$1]}" + shift + else + _color="0" + fi + echo -e "\e[${_color}m${@}\e[0m" +} + +txt_error(){ + colored "red" ${@} +} +txt_info(){ + colored "blue" ${@} +} +txt_darkblue(){ + colored "blue" ${@} +} +txt_message(){ + colored "magenta" ${@} +} +txt_magenta(){ + colored "magenta" ${@} +} +txt_blue(){ + colored "log" ${@} +} diff --git a/deb-src/etc/cron.daily/tmp-garbage-job.sh b/deb-src/etc/cron.daily/tmp-garbage-job.sh new file mode 100644 index 0000000..8f180f9 --- /dev/null +++ b/deb-src/etc/cron.daily/tmp-garbage-job.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e +for d in /home/*/Desktop/tmp; do + echo $d +done