Berkeley CSUA MOTD:Entry 19552
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/25 [General] UID:1000 Activity:popular
5/25    

2000/10/24 [Computer/SW/Unix] UID:19552 Activity:nil
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.
ERROR, url_link recursive (eces.Colorado.EDU/secure/mindterm2) 2025/05/25 [General] UID:1000 Activity:popular
5/25    

You may also be interested in these entries...
2012/8/29-11/7 [Computer/SW/Security] UID:54467 Activity:nil
8/29    There was once a CSUA web page which runs an SSH client for logging
        on to soda.  Does that page still exist?  Can someone remind me of the
        URL please?  Thx.
        \_ what do you mean? instruction on how to ssh into soda?
           \_ No I think he means the ssh applet, which, iirc, was an applet
              that implemented an ssh v1 client.  I think this page went away
	...
2012/9/20-11/7 [Computer/SW/Unix, Finance/Investment] UID:54482 Activity:nil
9/20    How do I change my shell? chsh says "Cannot change ID to root."
        \_ /usr/bin/chsh does not have the SUID permission set. Without
           being set, it does not successfully change a user's shell.
           Typical newbie sys admin (on soda)
           \_ Actually, it does: -rwsr-xr-x 1 root root 37552 Feb 15  2011 /usr/bin/chsh
	...
2012/9/24-11/7 [Computer/SW/Languages, Computer/SW/Unix] UID:54484 Activity:nil
9/24    How come changing my shell using ldapmodify (chsh doesn't work) doesn't
        work either? ldapsearch and getent show the new shell but I still get
        the old shell on login.
        \_ Scratch that, it magically took my new shell now. WTF?
           \_ probably nscd(8)
	...
2012/3/29-6/4 [Computer/HW/Memory, Computer/HW/CPU, Computer/HW/Drives] UID:54351 Activity:nil
3/29    A friend wants a PC (no mac). She doesn't want Dell. Is there a
        good place that can custom build for you (SSD, large RAM, cheap video
        card--no game)?
        \_ As a side note: back in my Cal days more than two decades ago when
           having a 387SX made me the only person with floating-point hardware,
           most machines were custom built.
	...
2012/4/27-6/4 [Computer/SW/Languages/Misc, Computer/SW/Unix] UID:54372 Activity:nil
4/27    I wrote a little shell script to collect iostat data:
        #!/bin/bash
        DATE=`date +%m%d`
        DATADIR=/var/tmp/user
        OUTPUTFILE=$DATADIR/$DATE.out
        while true
	...
2012/1/27-3/26 [Computer/SW/Unix] UID:54299 Activity:nil
1/27    Interesting list of useful unix tools. Shout out to
        cowsay even!
        http://www.stumbleupon.com/su/3428AB/kkovacs.eu/cool-but-obscure-unix-tools
        \_ This is nice.  Thanks.
	...
2011/10/26-12/6 [Computer/SW/Unix] UID:54202 Activity:nil
10/24  What's an easy way to see if say column 3 of a file matches a list of
       expressions in a file? Basically I want to combine "grep -f <file>"
       to store the patterns and awk's $3 ~ /(AAA|BBB|CCC)/ ... I realize
       I can do this with "egrep -f " and use regexp instead of strings, but
       was wondering if there was some magic way to do this.
       \_ UNIX has no magic. Make a shell script to produce the ask or egrep
	...
2011/5/19-7/13 [Computer/SW/Languages/Misc] UID:54115 Activity:nil
5/19    If script A runs, and calls script B ..... is it possible for me to exit\
        script A based on results of script B and not continue?
        \_ assume any shell
        \_ Yes.
           \_ without passing the result to some stupid temp file?
              \_ It sounds like you want "scriptb || exit", which will run
	...
2011/3/12-4/20 [Consumer/CellPhone, Computer/HW/Laptop] UID:54057 Activity:nil
3/12    I am curious what others think of tablets like iPad. They don't seem
        useful to me, but I use my computer for more than web browsing,
        Facebook, and Twitter. Why would I buy one instead of a laptop?
        They seem like a disabled laptop to me, but at a higher price.
        \_ You are most likely a coder.  iPad is not for coders.  They are
           what you get your non-technical friends.  Or musicians.  Look at
	...