Tim Peeler on Mon, 17 Jan 2000 01:47:23 -0500 (EST)


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

Re: [PLUG] check for existing user


On Sun, 16 Jan 2000, you wrote:
> > What does the 1>&2 mean in that?
> > > if (grep regexp foo 1>&2 > /dev/null) ; then
> 
> I think it means switch stdout and stderr, and redirect the output (stdout,
> which was previously stderr) to /dev/null so that it doesn't print anything
> on-screen.  Is that correct, Tim?
> 
> Bill
> 
> --
> "Because they know that all they sold you was a guaranteed POS!  Look, if
> you want me to take a dump in a box and mark it 'guaranteed', I will.  I got
> spare time."
>  -Chris Farley (on Microsoft?), _Tommy Boy_

Right, redirect stdout to stderr, then redirect to /dev/null.  If your grep
sends errors to stderr and normal to stdout:

fprintf(stderr, "foo");
fprintf(stdout, "fum");

that should keep your sh script from printing the grep info to screen.

Tim

______________________________________________________________________
Philadelphia Linux Users Group       -       http://plug.nothinbut.net
Announcements - http://lists.nothinbut.net/mail/listinfo/plug-announce
General Discussion   -   http://lists.nothinbut.net/mail/listinfo/plug