# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
export LS_COLORS=[...]
else # macOS `ls`
colorflag="-G"
export LSCOLORS=[...]
fi
At some point, the macOS version of ls started understanding the --color flag (I'm on 14.4.1)
I propose this instead, but I can't test it against earlier versions of macOS:
if ls --help > /dev/null 2>&1; then
echo "GNU ls";
else
echo "MacOS ls";
fi;
At some point, the macOS version of
ls
started understanding the--color
flag (I'm on 14.4.1)I propose this instead, but I can't test it against earlier versions of macOS:
PR to follow.