aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/ls.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bashrc.d/ls.bash')
-rw-r--r--bash/bashrc.d/ls.bash14
1 files changed, 14 insertions, 0 deletions
diff --git a/bash/bashrc.d/ls.bash b/bash/bashrc.d/ls.bash
new file mode 100644
index 00000000..6c793a52
--- /dev/null
+++ b/bash/bashrc.d/ls.bash
@@ -0,0 +1,14 @@
+# Apply color and exclusions to ls and grep
+eval "$(dircolors -b &>/dev/null)"
+
+# Function returns calculated options for ls
+function __lsopts {
+ local lsopts=
+ ls --help | grep -- --color &>/dev/null \
+ && lsopts="${lsopts} --color=auto"
+ echo $lsopts
+}
+
+# Alias ls with these options
+alias ls="ls $(__lsopts)"
+