Bug 140266 - bashrc independant of grep
Bug#: 140266 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: enhancement Priority: P2
Resolution: FIXED Assigned To: base-system@gentoo.org Reported By: michael@smith-li.com
Component: Core system
URL:  http://roy.marples.name/node/267
Summary: bashrc independant of grep
Keywords:  
Status Whiteboard: 
Opened: 2006-07-13 11:50 0000
Description:   Opened: 2006-07-13 11:50 0000
Per Roy's blog, I thought it would be more elegant if bashrc weren't dependant
on grep. (The bash ebuild doesn't state any direct dependency on grep anyway,
so it's a bit broken that bashrc uses it by default.)

To be attached shortly: a very slightly modified bashrc that doesn't use grep
(but is only useful for >=app-shells/bash-3.0 )

------- Comment #1 From Michael A. Smith 2006-07-13 11:51:41 0000 -------
Created an attachment (id=91654) [details]
bashrc

I think I said it all in comment #0

------- Comment #2 From SpanKY 2006-07-14 23:35:19 0000 -------
the unstated depend on grep is correct ... you cant even boot Gentoo without
grep, so having a few errors in bashrc is the least of your problems

however, i still see `grep` in your proposed bashrc :P

------- Comment #3 From Michael A. Smith 2006-07-15 09:36:26 0000 -------
Created an attachment (id=91792) [details]
bashrc

Oops! That's a redundant block of code that I forgot to delete. :-S

Yeah, I didn't really expect you to go "Wow, let's totally change the way we've
been using UNIX-like systems for the last 30 years because bash got smarter."

This is more a proof-of-concept. But it does work, and as Roy demonstrated,
it's a bit faster than grep. No harm there -- that's why I filed it as a
feature enhancement. That's what it is :-)

------- Comment #4 From SpanKY 2006-07-15 21:10:48 0000 -------
actually, you dont even need to use =~ since it isnt a regular expression

[[ $'\n'$(</etc/DIR_COLORS)$'\n' == *$'\n'"TERM ${safe_term}"$'\n'* ]]

------- Comment #5 From Michael A. Smith 2006-07-15 22:10:56 0000 -------
Created an attachment (id=91847) [details]
bashrc

(In reply to comment #4)
> actually, you dont even need to use =~ since it isnt a regular expression

Right you are, sir, and I think you just demonstrated a way this will work with
bash versions earlier than 3.

------- Comment #6 From SpanKY 2006-07-16 00:24:42 0000 -------
why did you comment out the last line ?

------- Comment #7 From Michael A. Smith 2006-07-16 09:08:53 0000 -------
Oops again :-/

I set it that way for testing, and forgot to remove the '#'. I guess the EPA
hates me.

------- Comment #8 From Roy Marples (RETIRED) 2006-07-18 09:44:08 0000 -------
Well, looks good to me - but uncomment the last line before it's comitted.

------- Comment #9 From Michael A. Smith 2006-07-18 09:51:35 0000 -------
Created an attachment (id=92138) [details]
bashrc

I really hope I didn't screw this one up. According to diff the only difference
between this and the previous one is the uncommented last line.

------- Comment #10 From SpanKY 2006-07-19 23:40:38 0000 -------
added to cvs, thanks