I am writing a bash script that has a configuration file. The configuration file will have sets of mode and mtu values. There can be zero or as many sets as the user defines. The bash script will source the configuration file.
This is going to stay a very simple program, so I don't need to get really fancy with it.
Each set can be defined by an alphanumeric string (it's a /dev/ name, without the /dev/).
Then, in each set, there's a mode, and an mtu value.
My thought is to create an /etc/ conf file in the format:
Or, for another system:
inf0_mode=connected inf0_mtu=65520 inf1_mode=datagram inf1_mtu=2044
Once I know the variable names, I can handle parsing the values and doing the rest.
But, how does a bash script handle not knowing exactly what names there will be?
Do I need to add to the conf:
Or, is that not needed?
If this is added, how do you use a variable name with prefix of a variable name, and suffix hard-coded like "_mode" and "_mtu"?