From bf91dd9422fc47f9130332ada8a200a7f2209daa Mon Sep 17 00:00:00 2001 From: Gardouille Date: Fri, 4 Aug 2017 15:50:57 +0200 Subject: [PATCH] Ensure to run "bonjour" function only if cowsay is available. --- zlogin | 2 +- zshrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zlogin b/zlogin index ad432dc..a8951c9 100644 --- a/zlogin +++ b/zlogin @@ -15,7 +15,7 @@ #uptime # If a network connection is available (check function def in zshrc) -if ( is_network ); then +if [( is_network )] && [ $(command -v cowsay) ]; then # Affiche un dessin (cf fonction définie dans zshrc) bonjour fi diff --git a/zshrc b/zshrc index c831c76..dd258c4 100644 --- a/zshrc +++ b/zshrc @@ -323,7 +323,7 @@ alias ccal='var=$(cal); echo "${var/$(date +%-d)/$(echo -e "\033[1;31m$(date +%- function bonjour() { MIN_TIME=$(date +%M) MODULO_MIN=$(($MIN_TIME % 2)) - if [ $(command -v bash_quote) ]; then + if [ $(command -v bash_quote) ] && [ $(command -v cowsay) ]; then if [ $MODULO_MIN -eq 0 ]; then #echo Bonjour $USER, nous sommes le `date +"%A %e %B %Y"`, et il est : `date +"%H"` h `date +"%M"` | cowsay -f $(/bin/ls /usr/share/cowsay/cows -1 | head -n $(expr $$$(date +%s) % $(ls /usr/share/cowsay/cows | wc -w) + 1) | tail -n 1) command bash_quote | cowsay -f $(/bin/ls /usr/share/cowsay/cows -1 | head -n $(expr $$$(date +%s) % $(ls /usr/share/cowsay/cows | wc -w) + 1) | tail -n 1)