aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.aliases7
1 files changed, 3 insertions, 4 deletions
diff --git a/.aliases b/.aliases
index 01d6181..dbcafeb 100644
--- a/.aliases
+++ b/.aliases
@@ -19,11 +19,10 @@ alias o="open"
alias oo="open ."
# Detect which `ls` flavor is in use
-tmp="$(ls --color 2>&1 > /dev/null | grep "illegal option")"
-if [ '' == "$tmp" ]; then # GNU `ls`
- colorflag="--color"
-else # OS X `ls`
+if ls --color 2> /dev/null | grep -q 'invalid option'; then # OS X `ls`
colorflag="-G"
+else # GNU `ls`
+ colorflag="--color"
fi
# List all files colorized in long format