cd $file_dir
what I am trying to do with this is to do an attachment of a file to from a directory and if the attachment is not found there then look into the other directory and do the attachment
if [ -f "${CLAIM_FILE_PREFIX}"*$(date +"%Y%m%d")*.html ] then
for FILE in ${CLAIM_FILE_PREFIX}*$(date +"%Y%m%d")*.html do
ATTACHMENT_ARGS="$ATTACHMENT_ARGS $FILE"
echo "$ATTACHMENT_ARGS"
done
else
cd $ARCHIVE_DIR
for FILE in ${CLAIM_FILE_PREFIX}*.html do
ATTACHMENT_ARGS="$ATTACHMENT_ARGS $FILE"
echo "$ATTACHMENT_ARGS"
done
fi
what I am trying to do with this is to do an attachment of a file to from a directory and if the attachment is not found there then look into the other directory and do the attachment
Please if someone could help with this syntax error which I am facing
When you cuddle
thenanddoon the same line asifandfor, you need a semicolon:Also, this is not right (beyond the above):
-fis used to test a single filename, not a list of them.Create an array of the files, using the
~(N)prefix so that the array is empty if the glob pattern matches nothing:Then, your
ifcondition will examine the number of files:Notes
+=to append to a variablePATH=somethingand then wonder why your script is broken.