aboutsummaryrefslogtreecommitdiff
path: root/sh/profile.d/welcome.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-11 14:52:11 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-11 14:52:11 +1300
commit6e8c6c521ae5d60427634be01b82fe61a79f192b (patch)
tree5349fc3e9838c69dbb6fd69f0234ea921ea446ea /sh/profile.d/welcome.sh
parente21b52c1f133f5c1f59f88a1bc266101577da6b3 (diff)
downloaddotfiles-6e8c6c521ae5d60427634be01b82fe61a79f192b.tar.gz
dotfiles-6e8c6c521ae5d60427634be01b82fe61a79f192b.zip
Refactor some conditionals
Diffstat (limited to 'sh/profile.d/welcome.sh')
-rw-r--r--sh/profile.d/welcome.sh10
1 files changed, 7 insertions, 3 deletions
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