From a34f7b72b9c42b726317f69072a1971603051193 Mon Sep 17 00:00:00 2001 From: Sean Trane Sciarrone Date: Mon, 15 May 2023 16:17:06 -0400 Subject: [PATCH] fix(system): improve ls coloring OS conditional --- system/aliases.zsh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/system/aliases.zsh b/system/aliases.zsh index daac4ae..288a149 100755 --- a/system/aliases.zsh +++ b/system/aliases.zsh @@ -7,15 +7,16 @@ alias reload="exec $SHELL -l" # Detect which `ls` flavor is in use -if [[ "$OSTYPE" == "darwin"* ]]; then - colorflag="-G" - timeflag="-T" -elif ls --color > /dev/null 2>&1; then # GNU `ls` +# FreeBSD, older versions of OS X, have different ls command. +if ls --color > /dev/null 2>&1; then colorflag="--color" - timeflag="--time-style=long-iso" -else # OS X `ls` +else colorflag="-G" +fi +if ls -T > /dev/null 2>&1; then timeflag="-T" +else + timeflag="--time-style=long-iso" fi # shellcheck disable=SC2034 colortimeflags="${colorflag} ${timeflag}"