aboutsummaryrefslogblamecommitdiff
path: root/sh/profile.d/downloads.sh
blob: fb8dd64aa6077cd2857b1b4a10361d87a2ce5389 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                   
                                   

                                                            








                                  
                                                                    

                             
# Only if shell is interactive
case $- in
    *i*) ;;
    *) return ;;
esac

# Only if not in a tmux window
[ -z "$TMUX" ] || return

# Not if ~/.hushlogin exists
[ -e "$HOME"/.hushlogin ] && return

# Not if ~/.downloads doesn't
[ -f "$HOME"/.downloads ] || return

# Count files in each directory, report if greater than zero
(
    while IFS= read -r dir ; do
        case $dir in
            '#'*) continue ;;
        esac
        [ -d "$dir" ] || continue
        set -- "$dir"/*
        [ -e "$1" ] || shift
        [ "$#" -gt 0 ] || continue
        printf '\nYou have %u unsorted files in %s.\n\n' "$#" "$dir"
    done < "$HOME"/.downloads
)