From: laredotornado on 2 May 2010 12:53 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 2 May 2010 12:48 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 ';'
|
Pages: 1 Prev: reading file into array Next: Use a clever "grep" or other command |