Created
May 19, 2017 17:09
-
-
Save raven-rock/aabb10fefe35ce9b5d61dd282464a4c2 to your computer and use it in GitHub Desktop.
Smart ls color flag for your .zshrc/.bashrc that works on Mac or Linux
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
# Detect which `ls` flavor is in use (Mac or Linux) | |
if ls --color > /dev/null 2>&1; then | |
ls_color_flag="--color" # GNU/Linux | |
else | |
ls_color_flag="-G" # BSD/macOS | |
fi | |
# Always show color when interactive | |
alias ls="ls ${ls_color_flag}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment