Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find command 1

Status
Not open for further replies.

spookie

Programmer
May 30, 2001
655
IN
Hi,

How do i filter out permission deny messages, while using find command, and display only matching records on screen?

Thanks

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
In place of '2>/dev/null', you can also turn off standard error:

2>-
 
Huh?!? olded, what shell does that work in? Every shell I know will send the output to a file with the filename "-". Are you sure?
 
KenCunningham
Adding 2>/dev/null works perfect.

Can you shed light on what it does exactly?

Thanks

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Hi spookie. The 2> is a redirection instructing the process to send any 'standard error' messages (such as the ones relating to permission denied), and /dev/null is known as the 'bit bucket' where superfluous messages disappear into the ether never to be seen again. Hope this explains sufficiently for your needs.
 
I don't mean to contradict Ken, but they don't disappear forever like he says. The file [tt]/dev/null[/tt] did used to be called "the bit bucket". That's because it's where you put all the unwanted and unused bits. That gives the system a ready supply of bits for when it needs them for making files, sending mail, printing, or displaying windows. Since you don't want those error messages, it's good practice to send them to the bit bucket so you can recycle them.

[rednose]
 
Sam:

I do apologize. I gave you the wrong syntax. This syntax turns off standard error file descriptor:

myunixcommand 2>&-

Of course, this closes the standard output file descriptor:

myunixcommand >&-



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top