-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaliases
More file actions
52 lines (48 loc) · 1.63 KB
/
aliases
File metadata and controls
52 lines (48 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# ~/.aliases
#
# Better safe than sorry
alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'
#
# Our beloved GREP_OPTIONS were deprecated and now we have this.
#
# grep: make GREP_OPTIONS obsolescent
# https://cgit.git.savannah.gnu.org/cgit/grep.git/commit/?id=50d843674e5df9f5d0111f07bbff8ce07c19df6a
#
# GREP_OPTIONS alternative?
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19998
#
case "$(uname -s)" in
NetBSD)
#
# In NetBSD, /usr/bin/grep is actually an old GNU/grep version
# which treats stdin as a device and thus skips it when --devices=skip is
# set. Instead of convincing the NetBSD maintainers to switch to BSD/grep
# we can just use the statically linked version in /rescue for now.
# See:
# Re: [netbsd-users] Re: How to build /usr/bin/grep?
# https://mail-index.netbsd.org/netbsd-users/2023/08/18/msg030044.html
#
grep --version 2>/dev/null | grep -Eq 'GNU|BSD' || return
alias grep='/rescue/grep --color=auto --devices=skip'
alias zgrep='/rescue/zgrep --color=auto --devices=skip'
;;
SunOS)
#
# Only the GNU/grep versions will understand these options.
#
ggrep --version 2>/dev/null | ggrep -Eq 'GNU|BSD' || return
alias ggrep='ggrep --color=auto --devices=skip'
alias gzgrep='gzgrep --color=auto --devices=skip'
;;
*)
# Everything else should be able to do the following:
grep --version 2>/dev/null | grep -Eq 'GNU|BSD' || return
alias grep='grep --color=auto --devices=skip'
alias zgrep='zgrep --color=auto --devices=skip'
alias bzgrep='bzgrep --color=auto --devices=skip'
alias xzgrep='xzgrep --color=auto --devices=skip'
alias zstdgrep='zstdgrep --color=auto --devices=skip'
esac