aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_profile.d
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bash_profile.d')
-rw-r--r--bash/bash_profile.d/fortune.bash8
-rw-r--r--bash/bash_profile.d/remind.bash8
-rw-r--r--bash/bash_profile.d/verse.bash15
3 files changed, 31 insertions, 0 deletions
diff --git a/bash/bash_profile.d/fortune.bash b/bash/bash_profile.d/fortune.bash
new file mode 100644
index 00000000..9caa3d3c
--- /dev/null
+++ b/bash/bash_profile.d/fortune.bash
@@ -0,0 +1,8 @@
+# If interactive shell and fortune(6) installed, print a short fortune
+if [[ $- == *i* ]] && hash fortune 2>/dev/null ; then (
+ if [[ -d "$HOME"/.local/share/games/fortunes ]] ; then
+ FORTUNE_PATH=${FORTUNE_PATH:-$HOME/.local/share/games/fortunes}
+ fi
+ fortune -sn "${FORTUNE_MAXSIZE:-1024}" "$FORTUNE_PATH"
+) ; fi
+
diff --git a/bash/bash_profile.d/remind.bash b/bash/bash_profile.d/remind.bash
new file mode 100644
index 00000000..50a3d8c8
--- /dev/null
+++ b/bash/bash_profile.d/remind.bash
@@ -0,0 +1,8 @@
+# If interactive and rem(1) installed, run it
+if [[ $- == *i* ]] && hash rem 2>/dev/null ; then (
+ printf '\n'
+ while read -r reminder ; do
+ printf '* %s\n' "$reminder"
+ done < <(rem -hq)
+) ; fi
+
diff --git a/bash/bash_profile.d/verse.bash b/bash/bash_profile.d/verse.bash
new file mode 100644
index 00000000..5d2538dc
--- /dev/null
+++ b/bash/bash_profile.d/verse.bash
@@ -0,0 +1,15 @@
+# Run verse(1) if it's installed and we haven't seen it already today (the
+# verses are selected by date); run in a subshell to keep vars out of global
+# namespace
+if [[ $- == *i* ]] && hash verse 2>/dev/null ; then (
+ date=$(date +%Y-%m-%d)
+ versefile=${VERSEFILE:-$HOME/.verse}
+ if [[ -e "$HOME"/.verse ]] ; then
+ read -r lastversedate < "$versefile"
+ fi
+ if [[ "$date" > "$lastversedate" ]] ; then
+ printf '\n%s\n\n' "$(verse)"
+ printf '%s\n' "$date" > "$versefile"
+ fi
+) ; fi
+