Issue
This topic is about the util 'ls' The BSD version uses the parameter '-G' to color up the output, while the Linux version uses parameter '--color'
Also the environment variable to set the colors is different: BSD: $LSCOLORS Linux: $LS_COLORS
But now the problem is: I want to determine which version is installed (using a small Shell script), so I can set alias ls and the environment appropriate in my .bachrc file.
Solution
As I mentioned above this seems to me to be the handiest method
if ls --color -d . >/dev/null 2>&1; then
GNU_LS=1
elif ls -G -d . >/dev/null 2>&1; then
BSD_LS=1
else
SOLARIS_LS=1
fi
I've essentially this in my l script, which I use on various platforms to tweak ls output as I like
Answered By - pixelbeat Answer Checked By - Dawn Plyler (WPSolving Volunteer)