From: laredotornado on
Hi,

I'm using Mac 10.6.3 and trying to write a shell script that will
execute a find function. Here is my script ...

#!/bin/sh
pattern=$1
shift
find "$@" -exec grep -i "$pattern" /dev/null {}

But upon executing,

../myfind.sh "hello" ~/Tomcat

I get this error. What do I need to correct in my shell script?
Thanks, - Dave

find: -exec: no terminating ";" or "+"
From: pk on
laredotornado wrote:

> Hi,
>
> I'm using Mac 10.6.3 and trying to write a shell script that will
> execute a find function. Here is my script ...
>
> #!/bin/sh
> pattern=$1
> shift
> find "$@" -exec grep -i "$pattern" /dev/null {}
>
> But upon executing,
>
> ./myfind.sh "hello" ~/Tomcat
>
> I get this error. What do I need to correct in my shell script?
> Thanks, - Dave
>
> find: -exec: no terminating ";" or "+"

As it says: add ';' or '+' at the end of the find command (you'll get
slightly different outputs if you use one or the other). ";" is a special
character to the shell, so you need to either escape it like \; or quote it
like ';'