bash: improve generate_config4() to not duplicate lines