UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 14th, 2002, 07:24 AM
digitsnake's Avatar
digitsnake digitsnake is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Orlando FL
Posts: 130 digitsnake User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 11
Send a message via Yahoo to digitsnake
find commnad

Hello,
Anyone knows how to suppress the msg from a 'find'command that said:

Quote:
find: cannot read dir /lost+found: Permission denied


???
__________________
Help me, help you, help others...

Reply With Quote
  #2  
Old November 14th, 2002, 11:51 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,966 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 52 m 24 sec
Reputation Power: 189
you could use
find ....... |grep -v "cannot read dir /lost+found: Permission denied"

or if you want to suppress all error messages use
find ...... 2>/dev/null
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #3  
Old November 25th, 2002, 07:34 AM
digitsnake's Avatar
digitsnake digitsnake is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Orlando FL
Posts: 130 digitsnake User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 11
Send a message via Yahoo to digitsnake
Hi, thanks for writing. Sorry I was out for a while and now I am back. Anyway, I tried your tips but still doesn't work.

MY ORIGINAL PROBLEM/QUESTION STARTED LIKE THIS:
tiger[zdeng]% find / -name 'bin'
find: cannot read dir /lost+found: Permission denied
find: cannot read dir /usr/lost+found: Permission denied
/usr/lib/lp/bin
/usr/sadm/lib/smc/bin
^C


THE GREP SOLUTION:
tiger[zdeng]% find / -name 'bin' |grep -v 'find: cannot read dir /lost+found'
find: cannot read dir /lost+found: Permission denied
find: cannot read dir /usr/lost+found: Permission denied
^C

THE STD ERROR REDIRECT SOLUTION:
tiger[zdeng]% find / -name 'bin' 2> /dev/null
find: bad option 2
find: path-list predicate-list

I am using tcsh as shell. More suggestion?

Reply With Quote
  #4  
Old November 25th, 2002, 01:02 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,966 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 52 m 24 sec
Reputation Power: 189
yes

for the grep - it could not work since find does write the errors to stderr.
so it has to be:

find / -name 'bin' 2>&1 |grep -v 'find: cannot read dir /lost+found'

The redirection would work in bash. for tcsh, use:

find / -name 'bin' |& grep -v 'find: cannot read dir /lost+found'

to suppress all error messages, you need to switch shells as tcsh cannot redirect stderr only.

Reply With Quote
  #5  
Old November 25th, 2002, 01:29 PM
digitsnake's Avatar
digitsnake digitsnake is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Orlando FL
Posts: 130 digitsnake User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 11
Send a message via Yahoo to digitsnake
So the trick is redirect std error to std out so grep can see... yeah works great! You are the best! thx ;-)

Reply With Quote
  #6  
Old November 6th, 2003, 02:57 PM
ryofnott ryofnott is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 1 ryofnott User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This command is for use in bash shell, not tcsh:

find / -name 'bin' 2>/dev/null

Reply With Quote
  #7  
Old November 6th, 2003, 03:07 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,966 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 52 m 24 sec
Reputation Power: 189
Quote:
Originally posted by ryofnott
This command is for use in bash shell, not tcsh:

find / -name 'bin' 2>/dev/null

Ok, kids: What does the author want to tell us? Read between the lines!

He clearly states that redirecting stderr to stdout is an act of oppression against harmless processes done by agressive forces straight from (s)hell.

Eat your supper, or you'll all be doomed!

...M

Last edited by M.Hirsch : November 6th, 2003 at 03:10 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > find commnad

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap