Sort:  

That's awesome, I learn best by trying to understand other peoples script. I have now installed shellcheck into my Linux Mint and it really does help. It also good to go check out shellcheck.net.

I really like how you set up the default values variables in your above example, simplifies things. Time to play around with some SHELL scriting over the next few nights.