I work on a bash script that uses part of filenames in order to be processed correctly. Here is example, having a filename that contains 'Catalog' in its name and this file is in pair with another file that contains 'product' in its name. There are more files and they need to be processed in a specific order, first files with "Catalog", then files with "ProductAttribute" in their names.
Have trying different things but still can not get working it. Here I have a hash table that associates the filenames
declare -A files
files=( ["Catalog"]="product" ["ProductAttribute"]="attribute")
for i in "${!files[@]}"; do
#list all files that contain "Catalog" & "ProductAttribute" in their filenames
`/bin/ls -1 $SOURCE_DIR|/bin/grep -i "$i.*.xml"`;
#once the files are found do something with them
#if the file name is "Catalog*.xml" use "file-process-product.xml" to process it
#if the file name is "ProductAttribute*.xml" use "file-process-attribute.xml" to process it
/opt/test.sh /opt/conf/file-process-"${files[$i]}.xml" -Dfile=$SOURCE_DIR/$i
done