diff rc/bash @ 238:5dcbf6ab0109

Prioritize gnuls over colorls on OpenBSD. Modified GNU ls alias to allow different executable name.
author Edho Arief <edho@myconan.net>
date Sun, 02 Oct 2011 07:22:57 +0700
parents 735b21c05f54
children ebfa844d2ef8
line wrap: on
line diff
--- a/rc/bash	Sun Oct 02 04:33:47 2011 +0700
+++ b/rc/bash	Sun Oct 02 07:22:57 2011 +0700
@@ -35,6 +35,7 @@
 _has_rm_I=
 _has_gnu_ls=
 _has_gnu_grep=
+_ls="ls"
 case "$(uname -s)" in
   Linux)
     _has_rm_I=y
@@ -59,7 +60,10 @@
     export LSCOLORS=ExGxFxdxCxegedabagExEx
   ;;
   OpenBSD)
-    if command -v colorls > /dev/null 2>&1; then
+    if command -v gls > /dev/null 2>&1; then
+      _has_gnu_ls=y
+      _ls="gls"
+    elif command -v colorls > /dev/null 2>&1; then
       export CLICOLOR=
       export LSCOLORS=ExGxFxdxCxegedabagExEx
       alias ls='colorls -F'
@@ -71,12 +75,13 @@
 esac
 
 [ "${_has_rm_I}" = y ] && alias rm="rm -I"
-[ "${_has_gnu_ls}" = y ] && alias ls="ls -F --color=auto"
+[ "${_has_gnu_ls}" = y ] && alias ls="${_ls} -F --color=auto"
 [ "${_has_gnu_grep}" = y ] && alias grep="grep --color=auto"
 
 unset _has_rm_I
 unset _has_gnu_ls
 unset _has_gnu_grep
+unset _ls
 
 
 case "${TERM}" in