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!