aboutsummaryrefslogtreecommitdiffstats
path: root/.aliases
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2012-07-23 15:45:47 +0200
committerMathias Bynens <mathias@qiwi.be>2012-07-23 15:45:47 +0200
commitcf79d2cdb811b689605ca5757508ce4a0bf2f127 (patch)
tree423524b87c47988441d677acbd2887e8e9225e99 /.aliases
parent4169a34df1783b6b0727a527b867cefecaa069b5 (diff)
downloaddotfiles-cf79d2cdb811b689605ca5757508ce4a0bf2f127.tar.gz
dotfiles-cf79d2cdb811b689605ca5757508ce4a0bf2f127.tar.bz2
dotfiles-cf79d2cdb811b689605ca5757508ce4a0bf2f127.zip
.aliases: Optimize the way we detect the `ls` flavor
Follow-up to 4169a34df1783b6b0727a527b867cefecaa069b5. Thanks to @janmoesen!
Diffstat (limited to '.aliases')
-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