Opened 12 years ago

Closed 12 years ago

#9044 closed bug (fixed)

[Terminal]: The output of <ef>grep should be colored

Reported by: Prasad Owned by: nobody
Priority: normal Milestone: R1
Component: Applications/Command Line Tools Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

all of the grep version have ability to colorize the output printed (using option --color). However, it seems like we are not using the capability and instead displaying the non-colored output.

It would be nice to display the colored output with grep.

Attachments (2)

0001-bash_profile-Turn-on-the-coloring-with-ef-grep.patch (957 bytes ) - added by Prasad 12 years ago.
0001-Turn-on-the-coloring-with-ef-grep.patch (1019 bytes ) - added by Prasad 12 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Prasad, 12 years ago

Version: R1/alpha3R1/Development

comment:2 by Prasad, 12 years ago

patch: 01

comment:3 by Prasad, 12 years ago

Following patch fixes the problem

From 9b031e26b7efd638fafcd972b9f5f06b2664ed83 Mon Sep 17 00:00:00 2001
From: Prasad Joshi <prasadjoshi.linux@gmail.com>
Date: Fri, 5 Oct 2012 09:53:54 +0530
Subject: [PATCH] bash_profile: Turn on the coloring with <ef>grep

All of the versions of grep have ability to display the colored
output. The patch turn ons the coloring in auto mode.

Fixes the ticket: https://dev.haiku-os.org/ticket/9044

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
---
 data/etc/profile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/data/etc/profile b/data/etc/profile
index e61bbc8..04a1896 100644
--- a/data/etc/profile
+++ b/data/etc/profile
@@ -24,6 +24,9 @@ export LC_COLLATE=$LC_MESSAGES
 export LC_CTYPE=$LC_MESSAGES
 export LC_MONETARY=$LC_NUMERIC
 
+alias egrep='egrep --color=auto'
+alias fgrep='fgrep --color=auto'
+alias grep='grep --color=auto'
 alias ls="ls --color=auto"
 alias ll="ls -lA"
 alias la="ls -A"
-- 
1.7.5.4

comment:4 by korli, 12 years ago

I think this kind of customization should go in a /etc/profile.d/colorgrep.sh script. Grep should also be outsourced to an optional package.

comment:5 by Prasad, 12 years ago

A new patch as suggested by korli

From b9a483e7a45e57699492876d6a5fffc5ca3c7f8e Mon Sep 17 00:00:00 2001
From: Prasad Joshi <prasadjoshi.linux@gmail.com>
Date: Fri, 5 Oct 2012 22:36:07 +0530
Subject: [PATCH] Turn on the coloring with <ef>grep

All of the versions of grep have ability to display the colored
output. The patch turn ons the coloring in auto mode.

Fixes the ticket: https://dev.haiku-os.org/ticket/9044

Changes Since V1:
	- instead of modifying data/etc/profile file put create a new
	grep specific file in /etc/profile.d/

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
---
 data/etc/profile.d/colorgrep.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 data/etc/profile.d/colorgrep.sh

diff --git a/data/etc/profile.d/colorgrep.sh b/data/etc/profile.d/colorgrep.sh
new file mode 100644
index 0000000..ada2d65
--- /dev/null
+++ b/data/etc/profile.d/colorgrep.sh
@@ -0,0 +1,3 @@
+alias egrep='egrep --color=auto'
+alias fgrep='fgrep --color=auto'
+alias grep='grep --color=auto'
-- 
1.7.5.4

comment:6 by korli, 12 years ago

Applied in hrev44680. Please note that as you're the author, you can't sign off your patch.

comment:7 by korli, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.