I'm trying to pipe the result of a find
command to a bash script. This is to simplify (maybe automate) a process I have been working on.
This is the command I would like to run
find . -type f -iname '*.mp4' -exec echo {}|./indexer.sh \;
indexer.sh
is ofc chmod +x
so it can execute.
indexer.sh
currently contains
#!/bin/zsh
read foo
echo "You entered '$foo'"
And if I run $ echo foo | ./indexer.sh
I get the output of
You entered 'foo'
But when I run find . -type f -iname '*.mp4' -exec echo {}|./indexer.sh \;
I receive the following error message:
find: -exec: no terminating ";" or "+"
You entered ''
So how can I pipe the output of find, into my script?
|
from the shell, sofind
doesn't see anything after the{}
. I don't thinkfind -exec
even uses a shell, though, so I wouldn't count on|
or>
working even if you did escape them.