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

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

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