Sam Trenholme's webpage
This article was posted to the Usenet group alt.hackers in 1995; any technical information is probably outdated.

Re: Boolean Grep?


Article: 7803 of alt.hackers
Newsgroups: alt.hackers
From: king@cs.wcu.edu (mark benedetto king)
Subject: Re: Boolean Grep?
X-Nntp-Posting-Host: tinuviel.cs.wcu.edu
Message-ID: D8Fq1G.76G@ecsvax.uncecs.edu
Sender: usenet@ecsvax.uncecs.edu (News Administrator)
Organization: UNC Educational Computing Service
Date: Thu, 11 May 1995 22:20:04 GMT
Approved: king@tinuviel.cs.wcu.edu
Lines: 18
Status: RO

chrisbib@umd.umich.edu (Christopher Bibbs) writes:


>Ok, I've been working on this for awhile and no one seems to be able to
>figure it out so I'll put it out here.  I'm trying to get grep or a grep
>like function to return a true-false to be used in a script.  Before you
>say use perl I should say that the point of this is expressly NOT to use
>perl.  Basically, I'm grepping some inputs and if true the script
>responds with (you guessed it) True.  We don't want to see the line(s) that
>triggered the true or the file name(s) just the line true.  If anyone has
>a clue, I'd love to hear it.

----
#!/bin/bash
if test -z "`grep $*`"; then echo Yes; else echo No; fi
-----

use it just like grep.  and man bash.



Parent

Back to index