I have a directory with some tif files I want to merge together depending on file suffixes (note the spaces in the file names):
File1 P1.tif
File1 P2.tif
File1 P3.tif
File2 P1.tif
File2 P2.tif
should result in merged tifs:
File1.tif
File2.tif
I have
for i in *\ P1.tif; do
match=${i/\ P1/\ P*}
out=${i/\ P1/}
echo "processing $match"
tiffcp "$match" "$out"
done
$match will contain File1 P*.tif and $out will contain File1.tif. but tiffcp will handle the first argument as a string and won't find a matching file. if a do not use quotes around $match the spaces in the file names will result in no matching file
so the question is: how do I pass a globbing string as an argument to a command?