Command line progress in dialog

An example that comes to mind would be this command. Basically you can see how the script calls itself in another thread, and intercommunicates between two with variables while displaying a progress dialog. I think it can serve as a base for you.