Created
June 6, 2022 21:11
-
-
Save ormaaj/f4ca0f3735807c384a973380689101c3 to your computer and use it in GitHub Desktop.
lol dircolors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setupDirColors { | |
if [[ ${FUNCNAME[0]} == "${FUNCNAME[1]}" ]]; then | |
typeset -n LS_COLORS=$1 | |
typeset dirc | |
if dirc=$("$(type -P dircolors 2>/dev/null)" -b); then | |
alias export=:; eval "$dirc"; unalias export | |
fi | |
else | |
typeset colors ret | |
if ! shopt -q expand_aliases; then | |
shopt -s expand_aliases | |
ret= | |
fi | |
"${FUNCNAME[0]}" colors | |
${colors:+\:} false && typeset -gx LS_COLORS=$colors | |
${ret+\:} shopt -u expand_aliases | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment