aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash')
-rw-r--r--bash/bash_profile10
-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
4 files changed, 41 insertions, 0 deletions
diff --git a/bash/bash_profile b/bash/bash_profile
index 7366840e..05b15693 100644
--- a/bash/bash_profile
+++ b/bash/bash_profile
@@ -11,6 +11,16 @@ elif ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} == 2)) && \
return
fi
+# Load any supplementary scripts
+if [[ -d $HOME/.bash_profile.d ]] ; then
+ for bash_profile in "$HOME"/.bash_profile.d/*.bash ; do
+ if [[ -e $bash_profile ]] ; then
+ source "$bash_profile"
+ fi
+ done
+ unset -v bash_profile
+fi
+
# Source interactive Bash config if it exists
if [[ -e $HOME/.bashrc ]] ; then
source "$HOME"/.bashrc
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
+