# Only if shell is interactive case $- in *i*) ;; *) return ;; esac # Only if not in a tmux window [ -z "$TMUX" ] || return # Only if ~/.hushlogin doesn't exist ! [ -e "$HOME"/.hushlogin ] || return # Run all of this in a subshell to clear it away afterwards ( # Temporary helper function welcome() { [ -e "${XDG_CONFIG_HOME:-"$HOME"/.config}"/welcome/"$1" ] || return command -v "$1" >/dev/null 2>&1 || return } # Show a fortune if welcome fortune ; then if [ -z "$FORTUNE_PATH" ] ; then FORTUNE_PATH=${XDG_DATA_HOME:-$HOME}/.local/share/fortune set -- "$FORTUNE_PATH"/*.dat if ! [ -e "$1" ] ; then FORTUNE_PATH=all fi fi fortune -s "$FORTUNE_PATH" printf '\n' fi # Print today's reminders with asterisks if welcome rem ; then rem -hq | sed 's/^/* /' printf '\n' fi # Run verse(1) if we haven't seen it already today if welcome verse ; then cache=${XDG_CACHE_HOME:-$HOME/.cache}/verse mkdir -p -- "$cache" if [ -f "$cache"/last ] ; then read -r last <"$cache"/last fi now=$(date +%Y%m%d) if [ "$now" -gt "${last:-0}" ] ; then verse printf '\n' printf '%s\n' "$now" >"$cache"/last fi fi )