diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-12-15 16:01:07 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-12-15 16:01:07 +1300 |
commit | 7b1b82761bcab157de124def3944dd95b19268b6 (patch) | |
tree | 1a181ac352e5963922c3a777322d9916d976950f /bash/bash_profile.d/remind.bash | |
parent | Remove unneeded args spec (diff) | |
download | dotfiles-7b1b82761bcab157de124def3944dd95b19268b6.tar.gz dotfiles-7b1b82761bcab157de124def3944dd95b19268b6.zip |
Flatten bash_profile.d subscripts a bit
Diffstat (limited to 'bash/bash_profile.d/remind.bash')
-rw-r--r-- | bash/bash_profile.d/remind.bash | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/bash/bash_profile.d/remind.bash b/bash/bash_profile.d/remind.bash index 3f9908a0..d006bb20 100644 --- a/bash/bash_profile.d/remind.bash +++ b/bash/bash_profile.d/remind.bash @@ -1,10 +1,17 @@ -# If interactive, ~/.reminders, and rem(1), run it -if [[ $- == *i* ]] && \ - [[ -e $HOME/.reminders ]] && \ - hash rem 2>/dev/null ; then ( - while read -r reminder ; do +# Only if shell is interactive +[[ $- == *i* ]] || return + +# Only if rem(1) available +hash rem 2>/dev/null || return + +# Only if $HOME/.reminders exists +[[ -e $HOME/.reminders ]] || return + +# Print from subshell to keep namespace clean +( + while IFS= read -r reminder ; do printf '* %s\n' "$reminder" done < <(rem -hq) printf '\n' -) ; fi +) |