find options don't work in script

Hi, I'm trying to write a bash script to find some files. However it seems that the find command is not behaving the same way when the script is executed as it does when executed from the command line:

Script extract:
#!/bin/bash
...
NEW="/usr/bin/find current/applications/ -name 'jar' -prune -o -name '*jboss' -prune -o -name '*sql' -prune -o -name '*jsp' -prune -o -print"
$NEW

This produces a different set of results than when the find command is executed from the command line - specifically, the prune option is ignored and all files are found.
I've included a call to . ${HOME}/.profile just in case - no luck.

And I've tried a variation of the find syntax like this, but with the same results.

/usr/bin/find current/ ( -name 'jar' -o -name '*\.svn' -o -name '*token*' -o -name '*gif' -o -name '*jpg' -o -name 'pdf' -o -name '*work' -o -name '*sql' -o -name '*class' ) -prune -o ( -type f -print )

Both of these commands work fine from the command line (although the brackets need to be escaped) but produce different results when run in the script.

Help!

Hi,
Are u executing the script from the same directory where you executed the command form command line?
Thanks
Raghuram

Hi Raghuram,

Of course, the command is being executed in the same directory.

However, I've discovered that if I unquote the strings, it works fine. So the prune command was working ok, but interpreting the strings literally.....

Problem solved!

When you typed the command interactively you did not have single quotes inside double quotes.

$ echo 'hello'   'world'
hello world
$ echo "  'hello'   'world'  "
  'hello'   'world'
$