diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2022-07-29 01:31:32 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2022-07-29 01:31:32 +1200 |
commit | 5bad95b47ef6b594a307fdd454641e99bec5947e (patch) | |
tree | b11b35270ab14e4a6c0b62eda1db7f105276f6ca /sh/profile.d/welcome.sh | |
parent | Remove disused $OS env var and switch (diff) | |
download | dotfiles-5bad95b47ef6b594a307fdd454641e99bec5947e.tar.gz dotfiles-5bad95b47ef6b594a307fdd454641e99bec5947e.zip |
Massively cut down profile scripts
Let's simplify all this a bit.
Diffstat (limited to 'sh/profile.d/welcome.sh')
-rw-r--r-- | sh/profile.d/welcome.sh | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/sh/profile.d/welcome.sh b/sh/profile.d/welcome.sh deleted file mode 100644 index 19231c2e..00000000 --- a/sh/profile.d/welcome.sh +++ /dev/null @@ -1,53 +0,0 @@ -# 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() { - test -e "${XDG_CONFIG_HOME:-"$HOME"/.config}"/welcome/"$1" - } - - # 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= - 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}/welcome - mkdir -p -- "$cache" || return - if [ -f "$cache"/verse ] ; then - read -r last <"$cache"/verse - fi - now=$(date +%Y%m%d) - if [ "$now" -gt "${last:-0}" ] ; then - verse - printf '\n' - printf '%s\n' "$now" >"$cache"/verse - fi - fi -) |