[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: shell script error



Thank You very much.  That did the trick.

> -----Original Message-----
> From: redhat-list-bounces redhat com [mailto:redhat-list-
> bounces redhat com] On Behalf Of Cesar Covarrubias
> Sent: Thursday, December 06, 2007 12:14 PM
> To: General Red Hat Linux discussion list
> Subject: Re: shell script error
> 
> Hello,
> 
> If my shell programming is as good as I hope, you need the following:
> 
> if [ ! -z `/bin/cat /tmp/BACKUP/tmp | /bin/grep 'not accepted'` ] ;
> then
> echo hi; else echo no; fi
> 
> The -z will apply the the output of the entire line, after the grep. I
> am sure if I am wrong, someone will be sure and educate us both and
> make
> us better shell programmers.
> 
> Very Respectfully,
> Cesar Covarrubias
> 
> On Thu, 2007-12-06 at 12:00 -0600, Steven Buehler wrote:
> > I hope this is the right list to ask this on.  I am creating a shell
> script
> > for something and the following line (whether run from the script or
> the
> > command line) gives me an error:
> > if [ ! -z /bin/cat /tmp/BACKUP/tmp | /bin/grep 'not accepted' ] ;
> then echo
> > hi; else echo no; fi
> >
> > Gives me the following error
> > -------------
> > -bash: [: missing `]'
> > grep: ]: No such file or directory
> > no
> > -------------
> >
> > If I run the command like the following, it works just fine:
> > /bin/cat /tmp/BACKUP/tmp | /bin/grep 'not accepted'
> >
> > Any help would be appreciated.
> >
> > Thanks
> > Steve
> >
> 
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request redhat com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]