aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/ls.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-07-30 17:13:49 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-07-30 17:13:49 +1200
commita2cac0511b53ba375e259a655fa17c0189fca22c (patch)
treeed1a7fb69ba9875e647efc881d9e01b4a8b8fcdb /bash/bashrc.d/ls.bash
parentUnset Fedora settings I dislike (diff)
downloaddotfiles-a2cac0511b53ba375e259a655fa17c0189fca22c.tar.gz
dotfiles-a2cac0511b53ba375e259a655fa17c0189fca22c.zip
Fix grep/ls aliasing for efficiency/correctness
Avoiding the use of echo, using builtins whereever possible
Diffstat (limited to 'bash/bashrc.d/ls.bash')
-rw-r--r--bash/bashrc.d/ls.bash6
1 files changed, 3 insertions, 3 deletions
diff --git a/bash/bashrc.d/ls.bash b/bash/bashrc.d/ls.bash
index 16172c73..26448e10 100644
--- a/bash/bashrc.d/ls.bash
+++ b/bash/bashrc.d/ls.bash
@@ -1,10 +1,10 @@
# Function returns calculated options for ls
__lsopts() {
local lsopts=
- local lshelp=$(ls --help)
- echo $lshelp | grep -- --color &>/dev/null \
+ local lshelp=$(ls --help 2>/dev/null)
+ [[ "$lshelp" == *--color* ]] \
&& lsopts="${lsopts} --color=auto"
- echo $lsopts
+ printf '%s' $lsopts
}
# Alias ls with these options