diff options
Diffstat (limited to 'sh/profile.d')
-rw-r--r-- | sh/profile.d/downloads.sh | 6 | ||||
-rw-r--r-- | sh/profile.d/options.sh | 5 | ||||
-rw-r--r-- | sh/profile.d/welcome.sh | 10 |
3 files changed, 14 insertions, 7 deletions
diff --git a/sh/profile.d/downloads.sh b/sh/profile.d/downloads.sh index 865cb859..1a89bc3f 100644 --- a/sh/profile.d/downloads.sh +++ b/sh/profile.d/downloads.sh @@ -8,7 +8,7 @@ esac [ -z "$TMUX" ] || return # Not if ~/.hushlogin exists -[ -e "$HOME"/.hushlogin ] && return +! [ -e "$HOME"/.hushlogin ] || return # Not if ~/.downloads doesn't [ -f "$HOME"/.downloads ] || return @@ -27,5 +27,7 @@ esac printf 'You have %u unsorted files in %s.\n' "$#" "$dir" lc=$((lc+1)) done < "$HOME"/.downloads - [ "$((lc > 0))" -eq 1 ] && printf '\n' + if [ "$lc" -gt 0 ] ; then + printf '\n' + fi ) diff --git a/sh/profile.d/options.sh b/sh/profile.d/options.sh index f89967cb..58376fb3 100644 --- a/sh/profile.d/options.sh +++ b/sh/profile.d/options.sh @@ -23,8 +23,9 @@ options() { # Iterate through remaining arguments (desired options), creating files to # show they're available if found in the help output for opt do - command -p grep -q -- '[^[:alnum:]]--'"$opt"'[^[:alnum:]]' help && - touch -- "$opt" + command -p grep -q -- \ + '[^[:alnum:]]--'"$opt"'[^[:alnum:]]' help || continue + touch -- "$opt" done } diff --git a/sh/profile.d/welcome.sh b/sh/profile.d/welcome.sh index ede7a05f..cdd41edb 100644 --- a/sh/profile.d/welcome.sh +++ b/sh/profile.d/welcome.sh @@ -20,8 +20,10 @@ esac # Show a fortune if welcome fortune ; then - [ -d "$HOME"/.local/share/games/fortunes ] && - : "${FORTUNE_PATH:="$HOME"/.local/share/games/fortunes}" + if ! [ -n "$FORTUNE_PATH"] && + [ -d "$HOME"/.local/share/games/fortunes ] ; then + FORTUNE_PATH=$HOME/.local/share/games/fortunes + fi fortune -s "$FORTUNE_PATH" printf '\n' fi @@ -34,7 +36,9 @@ esac # Run verse(1) if we haven't seen it already today if welcome verse ; then - [ -f "$HOME"/.verse ] && read -r last <"$HOME"/.verse + if [ -f "$HOME"/.verse ] ; then + read -r last <"$HOME"/.verse + fi now=$(date +%Y%m%d) if [ "$now" -gt "${last:-0}" ] ; then verse |