I recently submitted this e-mail but found that by using the eval command, and adding a slash (\) before the quotation mark fixed everything. Disregard the question below.
> > Hi, > > I am having trouble running a command in a shell script that runs without > a problem on the command line. Consider the following script: > > ======================================================================== > > #!/bin/bash > > entry="/cygdrive/c/Documents\ and\ Settings/arroyoa/Desktop" > exclude="-wholename '/cygdrive/c/Documents and > Settings/arroyoa/Desktop/asdf' -prune -o" > > #find "/cygdrive/c/Documents and Settings/arroyoa/Desktop/" -wholename > '/cygdrive/c/Documents and Settings/arroyoa/Desktop/asdf' -prune -o -print > > OFS="${IFS}" > IFS=$'\n' > > echo "find "$entry" $exclude -print" > for j in `find "$entry" $exclude -print`; do > echo "$j" > done > > ======================================================================== > > If you run the script above you will find the following output: > > find /cygdrive/c/Documents\ and\ Settings/arroyoa/Desktop -wholename > '/cygdrive/c/Documents and Settings/arroyoa/Desktop/asdf' -prune -o -print > find: unknown predicate `-wholename '/cygdrive/c/Documents and > Settings/arroyoa/Desktop/asdf' -prune -o' > > Then if you copy the command that was echoed and run it (find > /cygdrive/c/Documents\ and\ Settings/arroyoa/Desktop -wholename > '/cygdrive/c/Documents and Settings/arroyoa/Desktop/asdf' -prune -o > -print) then you no longer receive the error. What am I missing from the > script so that I can exclude these directories? > > Thanks, > Abi > >