From 6e8c6c521ae5d60427634be01b82fe61a79f192b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 11 Dec 2018 14:52:11 +1300 Subject: Refactor some conditionals --- sh/profile.d/welcome.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sh/profile.d/welcome.sh') diff --git a/sh/profile.d/welcome.sh b/sh/profile.d/welcome.sh index ede7a05f..cdd41edb 100644 --- a/sh/profile.d/welcome.sh +++ b/sh/profile.d/welcome.sh @@ -20,8 +20,10 @@ esac # Show a fortune if welcome fortune ; then - [ -d "$HOME"/.local/share/games/fortunes ] && - : "${FORTUNE_PATH:="$HOME"/.local/share/games/fortunes}" + if ! [ -n "$FORTUNE_PATH"] && + [ -d "$HOME"/.local/share/games/fortunes ] ; then + FORTUNE_PATH=$HOME/.local/share/games/fortunes + fi fortune -s "$FORTUNE_PATH" printf '\n' fi @@ -34,7 +36,9 @@ esac # Run verse(1) if we haven't seen it already today if welcome verse ; then - [ -f "$HOME"/.verse ] && read -r last <"$HOME"/.verse + if [ -f "$HOME"/.verse ] ; then + read -r last <"$HOME"/.verse + fi now=$(date +%Y%m%d) if [ "$now" -gt "${last:-0}" ] ; then verse -- cgit v1.2.3