comparison rc/bashrc @ 697:7359a8dbab5c

[bashrc] Simplify grep check and unify ls check
author nanaya <me@nanaya.pro>
date Sun, 23 Oct 2022 02:04:26 +0900
parents 3588f4f96c31
children 8c2ba562b15a
comparison
equal deleted inserted replaced
696:3588f4f96c31 697:7359a8dbab5c
130 [ -d "/opt/csw/gnu" ] && PATH="/opt/csw/gnu:${PATH}" 130 [ -d "/opt/csw/gnu" ] && PATH="/opt/csw/gnu:${PATH}"
131 [ -d "/opt/local/sbin" ] && PATH="/opt/local/sbin:${PATH}" 131 [ -d "/opt/local/sbin" ] && PATH="/opt/local/sbin:${PATH}"
132 [ -d "/opt/local/bin" ] && PATH="/opt/local/bin:${PATH}" 132 [ -d "/opt/local/bin" ] && PATH="/opt/local/bin:${PATH}"
133 alias ping="ping -s" 133 alias ping="ping -s"
134 alias ping6="ping -A inet6" 134 alias ping6="ping -A inet6"
135 if command -v gls > /dev/null 2>&1; then
136 _has_gnu_ls=y
137 _ls="gls"
138 fi
139 ;; 135 ;;
140 FreeBSD) 136 FreeBSD)
141 # Multi CPU awesomeness. 137 # Multi CPU awesomeness.
142 alias top="top -P" 138 alias top="top -P"
143 # FreeBSD grep isn't GNU grep but supports all of its commands 139 # The grep isn't GNU grep but supports all of its commands
144 _has_gnu_grep=y 140 _has_gnu_grep=y
145 ;; 141 ;;
146 OpenBSD)
147 if command -v gls > /dev/null 2>&1; then
148 _has_gnu_ls=y
149 _ls="gls"
150 elif command -v colorls > /dev/null 2>&1; then
151 alias ls="colorls -F"
152 fi
153 ;;
154 NetBSD|DragonFly) 142 NetBSD|DragonFly)
155 if command -v gls > /dev/null 2>&1; then 143 # The grep isn't GNU grep but supports all of its commands
156 _has_gnu_ls=y 144 _has_gnu_grep=y
157 _ls="gls"
158 elif command -v colorls > /dev/null 2>&1; then
159 alias ls="colorls -F"
160 fi
161 alias grep='grep --color=auto'
162 ;; 145 ;;
163 CYGWIN*) 146 CYGWIN*)
164 export PATH="${PATH}:${_org_path}" 147 export PATH="${PATH}:${_org_path}"
165 ;; 148 ;;
166 MSYS_NT-*) 149 MSYS_NT-*)
167 _has_gnu_ls=y 150 _has_gnu_ls=y
168 export PATH="${PATH}:${_org_path}" 151 export PATH="${PATH}:${_org_path}"
169 ;; 152 ;;
170 esac 153 esac
154
155 if command -v gls > /dev/null 2>&1; then
156 _has_gnu_ls=y
157 _ls="gls"
158 elif command -v colorls > /dev/null 2>&1; then
159 alias ls="colorls -F"
160 fi
171 161
172 if command -v ggrep > /dev/null 2>&1; then 162 if command -v ggrep > /dev/null 2>&1; then
173 _has_gnu_grep=y 163 _has_gnu_grep=y
174 _grep="ggrep" 164 _grep="ggrep"
175 fi 165 fi