[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: find error stream is annoying
From: |
Bernhard Voelker |
Subject: |
Re: find error stream is annoying |
Date: |
Wed, 8 Jul 2020 18:50:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 |
On 2020-07-08 16:17, Tomas wrote:
> If I try to search for the file hsbc I use the following command 'find -name
> *hsbc*'. Unfortunately, if there are directories I have no permission for,
> the stderr output completely opaques any useful answers.
> I'm aware there are workarounds, but I needed to find a file in a pinch, and
> it wasn't an appropriate time to search for unix pipe syntaxes.
The clear way to suppress this is to redirect the stderr stream to /dev/null
(or to another regular file one intends to inspect later):
$ find -name '*hsbc*' 2>/dev/null
BTW: this was not clear in your description above, but my example also
puts proper quoting around the file name pattern to search for.
Otherwise, the shell might expand it to existing file names in the current
directory and therefore change find's call parameter before that sees it.
> Suggestion:
> Do not print the error messages if the file has been found ;) If the file has
> not been found and some directories cannot be accessed print an error that
> explains that the file could not be found, THEN let the user know about the
> locked drawers and ask for their keys.
I'm afraid we cannot change the behavior in any of those directions,
because find works how it is specified.
Have a nice day,
Berny