0

My goal is to write a command to locate a file called MABLE on my server. Then I need to craft this command to report no permission errors, but print out every other error.

Currently, I'm using

find / -name MABLE 

After that, I'm putting in

ls -d mable

This is not working. Any better way write the command?

zx485
  • 2,865
jjc
  • 9

1 Answers1

1

You can use "process substitution" to pass the results of the find command to grep, in order to filter out the messages including : Permission denied as in:

find / -name MABLE 2> >(grep -v ': Permission denied')

2> captures the error output and redirects that to the grep command, to which that output appears as a file (an "unnamed pipe").

vanadium
  • 97,564