home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / shell / 5257 < prev    next >
Encoding:
Text File  |  1993-01-05  |  1.3 KB  |  33 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!stanford.edu!nntp.Stanford.EDU!dkeisen
  3. From: dkeisen@leland.Stanford.EDU (Dave Eisen)
  4. Subject: Re: Extracting regular expressions using egrep/
  5. Message-ID: <1993Jan5.202010.8287@leland.Stanford.EDU>
  6. Sender: ?@leland.Stanford.EDU
  7. Organization: Sequoia Peripherals, Inc.
  8. References: <1993Jan5.135145.28405@infolog.se> <1993Jan5.195647.19715@crd.ge.com>
  9. Date: Tue, 5 Jan 93 20:20:10 GMT
  10. Lines: 21
  11.  
  12. In article <1993Jan5.195647.19715@crd.ge.com> csdgwh@sn370.utica.ge.com (Glenn W. Hoffman) writes:
  13.  
  14. >works silently, i.e., returns only a status that you may test in the
  15. >if command. I am not a csh programmer, but it appears that you could say
  16. >  if (echo $var | egrep -s '<regexp>') then ...
  17.  
  18. No. The csh is looking for a boolean expression inside the
  19. parentheses; it is not looking for the exit status of a
  20. program like /bin/sh would do in the analogous situation.
  21.  
  22. This construct is usually written:
  23.  
  24. echo $var | egrep -s '<regexp>'
  25. if ( $status == 0 ) then ...
  26.  
  27.  
  28. -- 
  29. Dave Eisen                               Sequoia Peripherals: (415) 967-5644
  30. dkeisen@leland.Stanford.EDU              Home:                (415) 321-5154
  31.        There's something in my library to offend everybody. 
  32.           --- Washington Coalition Against Censorship
  33.