Added coloring aliases to fgrep egrep and grep
This commit is contained in:
parent
f5da03b349
commit
7b1d4574a3
7
color_grep.sh
Executable file
7
color_grep.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
/usr/libexec/grepconf.sh -c || return
|
||||
|
||||
alias grep='grep --color=auto' 2>/dev/null
|
||||
alias egrep='egrep --color=auto' 2>/dev/null
|
||||
alias fgrep='fgrep --color=auto' 2>/dev/null
|
||||
11
colorgrep.csh
Executable file
11
colorgrep.csh
Executable file
@ -0,0 +1,11 @@
|
||||
|
||||
# color-grep initialization
|
||||
|
||||
/usr/libexec/grepconf.sh -c
|
||||
if ( $status == 1 ) then
|
||||
exit
|
||||
endif
|
||||
|
||||
alias grep 'grep --color=auto'
|
||||
alias egrep 'egrep --color=auto'
|
||||
alias fgrep 'fgrep --color=auto'
|
||||
14
grep.spec
14
grep.spec
@ -1,10 +1,13 @@
|
||||
Name: grep
|
||||
Version: 3.7
|
||||
Release: 5
|
||||
Release: 6
|
||||
Summary: A string search utility
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grep/
|
||||
Source0: https://ftp.gnu.org/gnu/grep/grep-%{version}.tar.xz
|
||||
Source1: color_grep.sh
|
||||
Source2: colorgrep.csh
|
||||
Source3: grepconf.sh
|
||||
|
||||
Patch1: backport-grep-avoid-sticky-problem-with-f-f.patch
|
||||
Patch2: backport-grep-s-does-not-suppress-binary-file-matches.patch
|
||||
@ -34,6 +37,9 @@ CPPFLAGS="-I%{_includedir}/pcre2" CFLAGS="$RPM_OPT_FLAGS -fsigned-char"
|
||||
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
|
||||
|
||||
install -pm 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
|
||||
install -Dpm 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/grepconf.sh
|
||||
|
||||
%pre
|
||||
%preun
|
||||
%post
|
||||
@ -44,14 +50,20 @@ make check
|
||||
|
||||
%files
|
||||
%{_datadir}/locale/*
|
||||
%config(noreplace) %{_sysconfdir}/profile.d/color_grep.sh
|
||||
%config(noreplace) %{_sysconfdir}/profile.d/colorgrep.csh
|
||||
%doc NEWS README THANKS TODO
|
||||
%license COPYING AUTHORS
|
||||
%{_bindir}/*grep
|
||||
%{_libexecdir}/grepconf.sh
|
||||
%{_infodir}/grep.info.gz
|
||||
%{_mandir}/man1/*grep.1.gz
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jul 15 2022 panxiaohe <panxh.life@foxmail.com> - 3.7-6
|
||||
- Added coloring aliases to fgrep egrep and grep
|
||||
|
||||
* Tue Jun 28 2022 panxiaohe <panxh.life@foxmail.com> - 3.7-5
|
||||
- grep: Don't limit jitstack_max to INT_MAX
|
||||
- grep: speed up, fix bad-UTF8 check with -P
|
||||
|
||||
11
grepconf.sh
Executable file
11
grepconf.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
-c | --interactive-color)
|
||||
! grep -qsi "^COLOR.*none" /etc/GREP_COLORS
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Invalid / no option passed, so far only -c | --interactive-color is supported."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Loading…
x
Reference in New Issue
Block a user