10/23 on a Sun (solaris). if i use BASH and type grep i get gnu grep,
if i use [not BASH] i get the Uber-LAME grep that comes with
solaris. "which" indicates that they are the SAME grep. What
the hell is going on?
\_ Your fu is really weak, this is a $PATH problem.
\_ If your fu is so great why don't you explain WHY "which"
is leading me astray.
\_ Your problem is most likely related to "which"
screwing up when looking at $PATH (it screws up
because its a POS csh script). $PATH is set in
a shell's init scripts. Depending on your shell,
its value will be different. "which" is too stupid
to figure all this out and just gives you the lame
csh setting.
When using a Bourne shell (/bin/sh, /sbin/sh on
Solaris) or a Bourne-compatible shell (bash) use
"type" instead of "which" as God and Steve intended.
When using Korn shell, you should exec /bin/sh
and rm -f all instances of David Korn's greatest
mistake. If you insist on using a csh compatible
shell, please shoot yourself in the head or jump
in front of a car, or something to get yourself
removed from the gene pool.
\_ boy, can't everyone just get along, agree on
a friggin' standard so i don't have to be
annoyed by petty differences in execution
every time i use a new box. fer fuck's sake.
\_ There is a standard its called POSIX, barely
anyone uses it. The only shell standard
worth adhering to is Bourne Shell, as
concieved and created by the master in
tribute to one of the finest of languages
ALGOL.
Now about your GNU addition, perhaps you
should check yourself into the Betty Ford
clinic for recovering 31337 GNU/L1NUX
H@0XR5.
\_ I use tcsh because that is what the csua
gave me way back in 1992 and i'm too old
to change now.
\_ Put the following in your .cshrc (or
whatever you pagans use):
exec /bin/sh
One is never too old to renounce the
dark side.
\_ why doesn't bourne shell provide built-in
arithmetic? it really sucks when you're trying
to fix a system without /bin/expr..
\_ bc is usually available if expr isn't.
\_ but POSIX-sh does have it. And POSIX-sh is
basically ksh. So use ksh.
\_ What kind of a man recommends that David
Korn's most hateful rubbish ought to be
used?
\_ What's wrong with solaris grep (either /usr/bin or /usr/xpg4/bin)?
Are you addicted to all that non-standard GNU crap or something?
Damn kids and with thier 311T3 GNU/L1NUX B0X35.
\_ You misspelled 31337.
\_ S00RY.
\_ For starters solaris grep will not descend directory trees.
It is also lacking the -A and -B flags and others. -crebbs
\_ What's wrong with: find /dir -type f -name ... -exec grep {}
....
\_ where's the terminating semi?
\_ creates one grep per file, which is too much overhead.
Use xargs as God intended.
\_ Descending directory trees should not be a function
of grep, that would be stupid and inane and completely
opposed to the UNIX tools philosophy. Take some time
and read "Software Tools" and you will be enlightened.
Old jungle saying if you want to descend trees, use
find & xargs as the gods did in ages past:
find . -type f -print | xargs grep [options] [expr]
\_ With slight updating for correctness (it's what the
original authors would have wanted, had they wanted
their programs to actually work in the general case):
find . -type f -print0 | xargs -0 grep [options] [expr]
\_ older versions of Solaris did not have -print0,
since the original poster didn't specify which
version of Solaris he was using, I had to leave
this out.
\_ is this considered poor style:
grep [options] [expr] `find . -type f -print`
\_ Yes, little grasshopper. If your redirect
results in more than MAXARGS matches, the
command will fail.
\_ follow up from -crebbs unintentionally deleted.
\_ Actually, I intentionally deleted it -crebbs
(it basically said: i'm lazy and i don't really
care about the "UNIX tools philosophy" i care
that grep -r [expr] is easier to type. Though
i certainly don't need to read some book to
get the point being made, regardless of if i
agree)
\_ Software Tools is a book by Kernigan & Plaugher
that explains what the purpose of a "tool"
should be. The purpose of grep is global
regular expression print, it prints out
matching lines from a *FILE* or list of
*FILES* It has nothing to do with *DIRECTORIES*.
\_ The purpose of a tool is whatever i happen
to want to use it for. The primary purpose
of grep is to find something i'm looking for
but don't know where it is. Sometimes that
means i don't know where in a file. sometimes
that means in a directory and sometimes that
means in a directory tree. If i'm just
matching lines in the way you are thinking
i'm probably not using grep i'm usin PERL.
If all i ever used grep for was in shell
scripting i might agree with you.
\_ The primary purpose of grep is not
as you suggest to "find" things
that you are looking for but don't
know where they are. The primary
purpose of grep is "global regular
expression print", it is supposed
to print matching lines from a FILE.
Its job is not to guess what the
linguistically lazy mean. Perhaps
we can enhance the next version of
grep to include a Dieana Troi mode
where it senses what you want to
match and does a big song and dance
to help your find it.
\_ bash and it's default grep sucks.
How comes it's not a mail client too?
Plus, not only should it recursively
grep directories, it should grep
my inbox and mail-folders and also
check my .tar .gz and .zip files
automatically. In fact, you should
use EMACS instead.
\_ if you need this crap, use awk.
\_ awk is for piping $2 to xargs kill -9
\_ grep is grep. If you need more use Perl.
\_ oh please, why use perl, if you need more use JAVA. A
reasonable person uses the quickest/easiest tool available
to get the job done.
\_ And that's Java? Dude, you're sick. |