zshrc: cowsay Cowfile-Fix und Powerlevel10k Instant Prompt quiet

This commit is contained in:
rene 2026-03-15 10:51:09 +01:00
parent 3ad4382c50
commit 78aa88aa77

View file

@ -85,17 +85,18 @@ TRAPALRM() {
} }
# 11) Begruessung: zufaellig Systemstatus, Spruch oder Witz # 11) Begruessung: zufaellig Systemstatus, Spruch oder Witz
# (in exec-Block damit Powerlevel10k Instant Prompt nicht meckert)
if [[ -o interactive ]] && command -v cowsay &>/dev/null; then if [[ -o interactive ]] && command -v cowsay &>/dev/null; then
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
_greet() { _greet() {
local cow_files=(cow default tux sheep elephant) local cow_files=(default tux sheep elephant dragon gnu koala)
local cow="-f ${cow_files[$((RANDOM % ${#cow_files[@]} + 1))]}" local cow="${cow_files[$((RANDOM % ${#cow_files[@]} + 1))]}"
case $((RANDOM % 3)) in case $((RANDOM % 3)) in
0) # Systemstatus 0) # Systemstatus
local up host load local host load
host=$(hostname -s) host=$(hostname -s)
up=$(uptime | sed 's/.*up *\([^,]*\),.*/\1/')
load=$(uptime | sed 's/.*average[s]*: *\([^ ]*\).*/\1/') load=$(uptime | sed 's/.*average[s]*: *\([^ ]*\).*/\1/')
echo "$host | up $up | load $load" | cowsay $cow echo "$host | load $load" | cowsay -f "$cow"
;; ;;
1) # Datum-Spruch 1) # Datum-Spruch
local day=$(date +%u) msg local day=$(date +%u) msg
@ -108,13 +109,13 @@ if [[ -o interactive ]] && command -v cowsay &>/dev/null; then
6) msg="Samstag - Zeit fuer Projekte!" ;; 6) msg="Samstag - Zeit fuer Projekte!" ;;
7) msg="Sonntag - entspann dich mal." ;; 7) msg="Sonntag - entspann dich mal." ;;
esac esac
echo "$msg ($(date '+%d.%m.%Y, %H:%M'))" | cowsay $cow echo "$msg ($(date '+%d.%m.%Y, %H:%M'))" | cowsay -f "$cow"
;; ;;
2) # Witz/Spruch via fortune 2) # Witz/Spruch via fortune
if command -v fortune &>/dev/null; then if command -v fortune &>/dev/null; then
fortune -s 2>/dev/null | cowsay $cow fortune -s 2>/dev/null | cowsay -f "$cow"
else else
echo "Keine Witze installiert. Sad." | cowsay $cow echo "Keine Witze installiert. Sad." | cowsay -f "$cow"
fi fi
;; ;;
esac esac