Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for ls flavor in .aliases is no longer correct #1063

Open
djotto opened this issue Apr 17, 2024 · 0 comments
Open

Check for ls flavor in .aliases is no longer correct #1063

djotto opened this issue Apr 17, 2024 · 0 comments

Comments

@djotto
Copy link

djotto commented Apr 17, 2024

# 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;

PR to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant