aboutsummaryrefslogblamecommitdiff
path: root/bash/bash_profile.d/fortune.bash
blob: 5105b02d139c59410a729a6eb9a4712fae36c92e (plain) (tree)
1
2
3
4
5
6
7
8
9
                              


                         

                              


                                    


                                             
                                                        

                                                                       
               
                                                         
               
 
 
# 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 -sn "${FORTUNE_MAXSIZE:-768}" "$FORTUNE_PATH"
    printf '\n'
)