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

Re: Avoid "permission denied" in find command



Ah, csh doesn't allow seperating the stdout and stderr. What I previously stated will work in bash. You'll need to redirect both of them to the next command (Like more, or less).

find / |& more

The |& is what specifies both stderr and stdout.

-Brian McPherson


Jacob Fugal wrote:
I tried this on csh on a machine with:

SunOS hostname 5.6 Generic_105181-11 sun4u sparc SUNW,Ultra-1

And I got:

hostname% find /dir -name "foo*" 2>/dev/null
find: bad option 2
find: path-list predicate-list

Jacob Fugal
jpfugal@xxxxxxx


Brian McPherson wrote:
Jacob Fugal wrote:
Hello all,

Does anyone know a good way to avoid the "find: cannot read dir ' . . . . ' Permission denied" lines when executing the find command. In my experience it buries the useful information. I tried grep, but it appears that the | grep only gets the output and find pours this not very useful message to stderr. My only way around it is to sudo find, but I'm not sudo on every machine. Any ideas? It's really annoying.

Jacob Fugal
jpfugal@xxxxxxx

find foo 2> /dev/null


Sends stderr to /dev/null.

-Brian McPherson