Template Generation
Config Line
Assemble Settings
Generated configuration text often starts as a set of small scalar values. Joining the values into one predictable line keeps the result easy to inspect.
Program
Play the script to choose a log level and see the generated configuration line.
config_line_template.sh
#!/usr/bin/env bash
level=
workers=2
config="log_level=$level workers=$workers"
echo "$config"
#!/usr/bin/env bash
level=
workers=2
config="log_level=$level workers=$workers"
echo "$config"
config generation
Scripts can generate small config fragments from known values.
scalar value
Simple scalar values are easier to validate before writing a larger config.
quoted expansion
Double quotes keep the generated line together while expanding variables.