1

I have a script which I want to go over 4 sets of files PURO*.xml, PURR*.xml, SALO*.xml and SALR*.xml.

for j in PUR SAL
do
        mask=("${j}O*.xml" "${j}R*.xml")
        for k in 0 1
        do
                for file in `find ${CDIR} -maxdepth 1 -daystart -mtime ${MTIME} -and -name ${mask[$k]} | xargs`

The script works, however, when it is executed, if the working directory has files that match one of the mask, that mask gets expanded.

Question is, what would be the correct way to write the above piece of script so that mask is passed correctly to find command? I want "${j}" expanded at the point where I create mask, but not the "*".

Also, is backticked find OK or should I perhaps rewrite that part differently as well?

Gnudiff
  • 975

0 Answers0