Ensure to run "bonjour" function only if cowsay is available.

This commit is contained in:
gardouille 2017-08-04 15:50:57 +02:00
parent f4ed806529
commit bf91dd9422
2 changed files with 2 additions and 2 deletions

2
zlogin
View File

@ -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

2
zshrc
View File

@ -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)