aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_profile.d/fortune.bash
blob: cc16ff05671b9b747f32cff231650a25dc6d047b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Only if shell is interactive
if [[ $- != *i* ]] ; then
    return
fi

# Only if fortune(6) available
if ! hash fortune 2>/dev/null ; then
    return
fi

# Print from subshell to keep namespace clean
(
    if [[ -d $HOME/.local/share/games/fortunes ]] ; then
        FORTUNE_PATH=${FORTUNE_PATH:-$HOME/.local/share/games/fortunes}
    fi
    printf '\n'
    fortune -s "$FORTUNE_PATH"
    printf '\n'
)