I am trying to use the shell to loop sequentially through images in one folder and compare with the latest image in another folder.
One error i'm getting is -
zsh: no matches found: /TiffOut/*.tiff(.om[1])
Though I wouldn't be surprised if that's not the only problem.
What I'm hoping to acheive is:
Here's my full script -
#! /bin/zsh -
filelist=$(ls | grep '.tiff')
for image_file in $filelist
do
latest=$(/TiffOut/*.tiff(.om[1]))
magick $image_file $latest -evaluate-sequence Max '/TiffOut/out_${imagefile}.tiff'
done
Thanks for reading
There are a few issues with your script - give this one a try:
#!/bin/zsh
for image_file in *.tiff
do
latest=(./TiffOut/*.tiff(.om[1]))
magick "$image_file" "$latest" -evaluate-sequence Max "./TiffOut/out_${image_file}"
done
Some notes:
grep
to narrow down the file list; just use a glob pattern (*.tiff
)..
, hence ./TiffOut/*.tiff
. Paths beginning with /
are absolute, starting at the root directory..om
glob qualifiers. It's not a command, which is what $(...)
indicates. With just the parentheses, it's an assignment of an array, with a single member.$something
) are only expanded in strings quoted with double-quotes, not single quotes.magick
command does what you want.You may be able to use the terms in my notes to find more information about the pieces of the script.
Good luck!