aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/ls.bash
blob: 6c793a52548b99b3d66b8b553c0d7b82763cbc64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Apply color and exclusions to ls and grep
eval "$(dircolors -b &>/dev/null)"

# Function returns calculated options for ls
function __lsopts {
    local lsopts=
    ls --help | grep -- --color &>/dev/null \
        && lsopts="${lsopts} --color=auto"
    echo $lsopts
}

# Alias ls with these options
alias ls="ls $(__lsopts)"