aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-12-15 16:18:51 +1300
committerTom Ryder <tom@sanctum.geek.nz>2015-12-15 16:18:51 +1300
commit9dcac1c4716ece1fe79e4e721d57b5b247947cad (patch)
tree282794374b3afd095e114dc7ad2eeee3ede9617e /bash
parentFlatten bash_profile.d subscripts a bit (diff)
downloaddotfiles-9dcac1c4716ece1fe79e4e721d57b5b247947cad.tar.gz
dotfiles-9dcac1c4716ece1fe79e4e721d57b5b247947cad.zip
Make short-circuits a bit more explicit
Diffstat (limited to 'bash')
-rw-r--r--bash/bash_profile.d/fortune.bash8
-rw-r--r--bash/bash_profile.d/remind.bash14
-rw-r--r--bash/bash_profile.d/verse.bash8
3 files changed, 22 insertions, 8 deletions
diff --git a/bash/bash_profile.d/fortune.bash b/bash/bash_profile.d/fortune.bash
index 9879716a..5105b02d 100644
--- a/bash/bash_profile.d/fortune.bash
+++ b/bash/bash_profile.d/fortune.bash
@@ -1,8 +1,12 @@
# Only if shell is interactive
-[[ $- == *i* ]] || return
+if [[ $- != *i* ]] ; then
+ return
+fi
# Only if fortune(6) available
-hash fortune 2>/dev/null || return
+if ! hash fortune 2>/dev/null ; then
+ return
+fi
# Print from subshell to keep namespace clean
(
diff --git a/bash/bash_profile.d/remind.bash b/bash/bash_profile.d/remind.bash
index d006bb20..92f13924 100644
--- a/bash/bash_profile.d/remind.bash
+++ b/bash/bash_profile.d/remind.bash
@@ -1,11 +1,17 @@
# Only if shell is interactive
-[[ $- == *i* ]] || return
+if [[ $- != *i* ]] ; then
+ return
+fi
# Only if rem(1) available
-hash rem 2>/dev/null || return
+if ! hash rem 2>/dev/null ; then
+ return
+fi
-# Only if $HOME/.reminders exists
-[[ -e $HOME/.reminders ]] || return
+# Only if reminders file exists
+if [[ ! -e ${DOTREMINDERS:-$HOME/.reminders} ]] ; then
+ return
+fi
# Print from subshell to keep namespace clean
(
diff --git a/bash/bash_profile.d/verse.bash b/bash/bash_profile.d/verse.bash
index d7877a05..f463d074 100644
--- a/bash/bash_profile.d/verse.bash
+++ b/bash/bash_profile.d/verse.bash
@@ -1,8 +1,12 @@
# Only if shell is interactive
-[[ $- == *i* ]] || return
+if [[ $- != *i* ]] ; then
+ return
+fi
# Only if verse(1) available
-hash fortune 2>/dev/null || return
+if ! hash verse 2>/dev/null ; then
+ return
+fi
# Run verse(1) if we haven't seen it already today (the verses are selected by
# date); run in a subshell to keep vars out of global namespace