I'm running under Big Sur
(macOS 11.6). I have a shell script which launches a Finder window to a certain directory as follows:
/usr/bin/open /path/to/directory
After the shell script opens this Finder window in that manner, I'd like that shell script to wait while periodically polling for the existence of that Finder window. Once that particular Finder window gets closed, I'd then like my shell script to stop waiting and continue processing.
Is there a way to do this in macOS 11.6?
Thank you very much in advance.