zshrc: cowsay Begruessung mit Systemstatus, Tagesspruch oder Witz
This commit is contained in:
parent
c3f4ae7408
commit
3ad4382c50
1 changed files with 39 additions and 0 deletions
39
zsh/.zshrc
39
zsh/.zshrc
|
|
@ -83,3 +83,42 @@ TRAPALRM() {
|
||||||
command -v asciiquarium &>/dev/null && screensavers+=("asciiquarium")
|
command -v asciiquarium &>/dev/null && screensavers+=("asciiquarium")
|
||||||
(( ${#screensavers[@]} )) && eval "${screensavers[$((RANDOM % ${#screensavers[@]} + 1))]}"
|
(( ${#screensavers[@]} )) && eval "${screensavers[$((RANDOM % ${#screensavers[@]} + 1))]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 11) Begruessung: zufaellig Systemstatus, Spruch oder Witz
|
||||||
|
if [[ -o interactive ]] && command -v cowsay &>/dev/null; then
|
||||||
|
_greet() {
|
||||||
|
local cow_files=(cow default tux sheep elephant)
|
||||||
|
local cow="-f ${cow_files[$((RANDOM % ${#cow_files[@]} + 1))]}"
|
||||||
|
case $((RANDOM % 3)) in
|
||||||
|
0) # Systemstatus
|
||||||
|
local up host load
|
||||||
|
host=$(hostname -s)
|
||||||
|
up=$(uptime | sed 's/.*up *\([^,]*\),.*/\1/')
|
||||||
|
load=$(uptime | sed 's/.*average[s]*: *\([^ ]*\).*/\1/')
|
||||||
|
echo "$host | up $up | load $load" | cowsay $cow
|
||||||
|
;;
|
||||||
|
1) # Datum-Spruch
|
||||||
|
local day=$(date +%u) msg
|
||||||
|
case $day in
|
||||||
|
1) msg="Montag... Kaffee ist Pflicht!" ;;
|
||||||
|
2) msg="Dienstag - immerhin kein Montag mehr." ;;
|
||||||
|
3) msg="Mittwoch - Bergfest!" ;;
|
||||||
|
4) msg="Donnerstag - morgen ist fast Wochenende!" ;;
|
||||||
|
5) msg="Freitag! Die Woche gehoert dir." ;;
|
||||||
|
6) msg="Samstag - Zeit fuer Projekte!" ;;
|
||||||
|
7) msg="Sonntag - entspann dich mal." ;;
|
||||||
|
esac
|
||||||
|
echo "$msg ($(date '+%d.%m.%Y, %H:%M'))" | cowsay $cow
|
||||||
|
;;
|
||||||
|
2) # Witz/Spruch via fortune
|
||||||
|
if command -v fortune &>/dev/null; then
|
||||||
|
fortune -s 2>/dev/null | cowsay $cow
|
||||||
|
else
|
||||||
|
echo "Keine Witze installiert. Sad." | cowsay $cow
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
_greet
|
||||||
|
unfunction _greet
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue