From 6b9658ab1dd8f637db6503b84f9e4cc804a1b675 Mon Sep 17 00:00:00 2001 From: rene Date: Sun, 15 Mar 2026 14:38:35 +0100 Subject: [PATCH] zshrc: cowsay Cowfiles dynamisch filtern (macOS-Kompatibilitaet) Auf macOS (Homebrew) fehlt die 'gnu' Cowfile, was beim Login zu "Could not find cowfile for 'gnu'!" fuehrte. Cowfiles werden jetzt gegen die tatsaechlich installierten geprueft. --- zsh/.zshrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 65c82ae..6e36edc 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -175,7 +175,13 @@ TRAPALRM() { # Begruessung: zufaellig Systemstatus, Spruch oder Witz if [[ -o interactive ]] && command -v cowsay &>/dev/null; then _greet() { - local cow_files=(default tux sheep elephant dragon gnu koala) + local all_cows=(default tux sheep elephant dragon gnu koala) + local cow_files=() + local cowpath=$(cowsay -l 2>/dev/null | tail -n +2 | tr ' ' '\n') + for c in "${all_cows[@]}"; do + echo "$cowpath" | grep -qx "$c" && cow_files+=("$c") + done + (( ${#cow_files[@]} == 0 )) && cow_files=(default) local cow="${cow_files[$((RANDOM % ${#cow_files[@]} + 1))]}" case $((RANDOM % 3)) in 0) # Systemstatus