bash check if var is set first... fix type also