I'll fix that up - something must have changed the logic in bash as it's fine on my ubuntu desktop and on raspbian. Maybe a specific version of bash has some different behaviour, but the variable should be initialised so I will do that.