Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

peter-d/config-parser

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

config-parser

Configuration (ini style) parser in Bash

About

This script is freely inspired by bash ini parser from ajdiaz. It's a fast way to parse an ini-style configuration file and to load the variables in your main script.

License

This script is under the MIT License. See LICENSE file.

Dependencies

config-parser.sh uses sed to parse the ini file.

Usage

Just include config-parser.sh in your code, and then call it:

# parse the configuration file
config_parser "/path/to/config/file.ini";
# load <my_section> from the ini file
config.section.<my_section>;

INI File example

[dev]
foo="bar";
foofoo="foo";
foofoofoo="$foofoo $foo";

[prod]
foo="foo";
foofoo="bar";
foofoofoo="$foofoo $foo";

If we run the following code against this example:

config_parser "/path/to/example/file.ini";
config.section.dev;
echo "$foofoofoo";
config.section.prod;
echo "$foofoofoo";

We'll get this output:

foo bar
bar foo

About

Configuration (ini style) parser in Bash

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.