bash-config-parser
is a Bash function for parsing of traditional configuration
files like /etc/adduser.conf
in Debian GNU/Linux. So it provides simple
parsing in the form of key = value
.
Any recent versions of GNU Bash, GNU sed, GNU Grep.
- All values could be written as is or enclosed in single or double quotes.
- Comments could be written in separate lines or on the same lines as
key = value
definitions. Everything starting by#
character is considered as a comment.
bash-config-parser
does not support sections.
Not required. Clone this repository and use config-parser.sh
as described
below.
Configuration file might look like this sample. You need to
create a script and a configuration file with the same name, but with the conf
extension, for example, sample.sh
and sample.conf
, and put both files in the
same directory. Source config-parser.sh
in your script and call process
function. After that you can get an access to all options in your configuration
file like in this sample script.