diff options
author | Mathias Bynens <mathias@qiwi.be> | 2012-07-23 15:45:47 +0200 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2012-07-23 15:45:47 +0200 |
commit | cf79d2cdb811b689605ca5757508ce4a0bf2f127 (patch) | |
tree | 423524b87c47988441d677acbd2887e8e9225e99 /.aliases | |
parent | 4169a34df1783b6b0727a527b867cefecaa069b5 (diff) | |
download | dotfiles-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-- | .aliases | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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 |