aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_profile.d/fortune.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bash_profile.d/fortune.bash')
-rw-r--r--bash/bash_profile.d/fortune.bash8
1 files changed, 8 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
+