what does this statement mean? grep -c user /etc/* 2> /dev/null

what does this statement mean? grep -c user /etc/* 2> /dev/null

Post by Vina » Mon, 25 Jun 2001 17:43:55



grep -c user /etc/* 2> /dev/null

Can anyone please explain what 2> /dev/null is used here...
Thanks
Vinay

 
 
 

what does this statement mean? grep -c user /etc/* 2> /dev/null

Post by Adam Pric » Mon, 25 Jun 2001 17:53:09



> grep -c user /etc/* 2> /dev/null

> Can anyone please explain what 2> /dev/null is used here...
> Thanks
> Vinay

Redirect data on file-descriptor 2 (Normally stderr) to the file /dev/null (Normally
a device special file which will discard all input).
Or in plain English.. It throws away the error messages from the grep command.
HTH
Adam

 
 
 

what does this statement mean? grep -c user /etc/* 2> /dev/null

Post by James T. Denni » Wed, 27 Jun 2001 05:37:38




>> grep -c user /etc/* 2> /dev/null
>> Can anyone please explain what 2> /dev/null is used here...
>> Thanks
>> Vinay
> Redirect data on file-descriptor 2 (Normally stderr) to the file /dev/null (Normally
> a device special file which will discard all input).
> Or in plain English.. It throws away the error messages from the grep command.
> HTH
> Adam

 A higher level interpretation of this command is:

        count the number of times the term "user" appears in
        all of the files under /etc (but not recursing below that)
        --- and throw away error messages about how grep can't
        open/search directories, dangling symlinks, or any "permission
        denied" type errors)

 
 
 

1. HELP: 2>&1 > /dev/null != 2>&- > /dev/null ???

In /bin/sh, I tried to redirect the standard error and standard output to
/dev/null.

I still has the error message from the following command:

        ls /xyz 2>&1 > /dev/null

but not from the following command:

        ls /xyz 2>&- > /dev/null

I thought >&1 is the same as >&-. Any comments are appreciated.

Thank you.

Larry

2. Compiling Problems Redhat 4

3. rsh machine -n 'command >&/dev/null </dev/null &'

4. libaio 0.3.90 -- test release for sync up

5. What could ">& dev/null" mean?

6. CGI under Netsite?

7. setting 2>&1 >>/dev/null for a chunk of script

8. SCO Arcserve 2.2 and Win 95 clients

9. Nowhere Man >> Unix Man 2>/dev/null :-)

10. /etc/aliases to point user mail to /dev/null

11. Users don't have access to /tmp and /dev/null etc... ??????????

12. scoadmin -> Account Manager -> Users -> Add New Users breaks /etc/password symlink

13. cp /dev/null or cat /dev/null