Configuration Files
Source Config
Loading Shell Assignments
source runs shell assignment lines in the current shell, so later commands can use the loaded variables.
Program
Play the script to load a selected profile name and use the sourced settings.
source_config_stream.sh
#!/usr/bin/env bash
profile=
source <(printf "host=%s\nretries=%s\n" "${profile}.local" "2")
label="${profile}:${host}:${retries}"
echo "$label"
#!/usr/bin/env bash
profile=
source <(printf "host=%s\nretries=%s\n" "${profile}.local" "2")
label="${profile}:${host}:${retries}"
echo "$label"
#!/usr/bin/env bash
profile=
source <(printf "host=%s\nretries=%s\n" "${profile}.local" "2")
label="${profile}:${host}:${retries}"
echo "$label"
source
`source file` evaluates assignment lines in the current shell.
current shell
Variables loaded by `source` remain available to following commands.
profile
A profile name can choose which settings are loaded.