You are not logged in.

#1 2005-06-25 02:54:04

mune
Member
From: Earth
Registered: 2005-01-07
Posts: 12
Website

find (permission denied warnings)

Is there any way to not display those annoying "find: permission denied" errors?  I'm well aware that I don't have access to certain folders and I don't need find telling me tongue .  I tried -nowarn but to no avail.  Also, I tried searching the forums/google but there is far too much ambiguity in the word "find"  :cry: .

I found somewhere that you can simply type

find /tmp -name foo 2> /dev/null

However, it's rather annoying to type that after every find command.  Any ideas?


--mune
(Alyptic)

Offline

#2 2005-06-25 03:21:03

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: find (permission denied warnings)

well you could just do a script:

#!/bin/bash
[ $# != 2 ] && {
    echo "requires two fields!"
     exit 1
}
find $1 -name $2 2>/dev/null

then you would just need to type in <script> /tmp foo

but move it to /usr/bin/ and chmod 755 to make it global.

Offline

#3 2005-06-25 04:39:47

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: find (permission denied warnings)

You could also make the script a function in your ~/.bashrc, since its so small.

Offline

#4 2005-06-25 08:44:32

sudman1
Member
From: Huntingdon, UK
Registered: 2005-02-18
Posts: 143

Re: find (permission denied warnings)

You can just

find / -name foo 2> /dev/null

v/r
Suds

Offline

#5 2005-06-25 08:59:04

juergen
Developer
From: Frankfurt/Germany
Registered: 2005-04-11
Posts: 48
Website

Re: find (permission denied warnings)

i prefer alias:

alias fn="find 2>/dev/null"

Offline

#6 2005-06-25 13:14:27

mune
Member
From: Earth
Registered: 2005-01-07
Posts: 12
Website

Re: find (permission denied warnings)

Thanks big_smile All of those work great.


--mune
(Alyptic)

Offline

#7 2005-06-25 22:43:45

Euphoric Nightmare
Member
From: Kentucky
Registered: 2005-05-02
Posts: 283

Re: find (permission denied warnings)

You could alternatively use 'slocate', if that fits your needs.  'slocate -u' as root to update the list.

Offline

Board footer

Powered by FluxBB