Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

find: -exec: no terminating ";" or "+"

1,037 views
Skip to first unread message

laredotornado

unread,
May 2, 2010, 12:53:15 PM5/2/10
to
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 "+"

pk

unread,
May 2, 2010, 12:48:46 PM5/2/10
to
laredotornado wrote:

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 ';'

0 new messages