Using find -exec and having trouble with redirecting standard error Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Using find -exec and having trouble with redirecting standard error without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I have an individual.sh script that pipes standard error to a grep command, like this:

FOUND=$(tesseract "$i" out -psm 0 |& grep -ci 'Orientation in degrees: [^0]')

If I run the script like this I have no problems ./individual.sh filename

But I want to pipe a bunch of files into the script. I am using this command to do so:

find corpus/ -type f -exec ./individual.sh {} ;

which is throwing this error from the line in individual.sh that redirects standard error.

./individual.sh: 7: ./individual.sh: Syntax error: "&" unexpected

How do I redirect standard error while using the find -exec option

Answer

Maybe you’re using zsh. Try adding as the first line of the file, #!/usr/bin/zsh.

We are here to answer your question about Using find -exec and having trouble with redirecting standard error - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji