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

Sign up
Appearance settings

A Couple Suggestions #4

Open
Open
Labels
bugSomething isn't working documentationImprovements or additions to documentation good first issueGood for newcomers
@xrxca

Description

I was looking for bash handling of INI files rather than rolling my own and came across this which has some usable ideas.

However I find the returns on some of your functions to be backwards, for example:
ini_section_test returns 0 if the section doesn't exist and 1 if it does, which seems to got totally against posix shell conventions which is zero for true and non-zero for false.

to use your function as part of regular shell operations, the test has to be negated

if ! ini_section_test "${ini_data}" SectionName
then
 echo "Section Exists"
else
 echo "Section not Found"
fi

Which is highly counter intuitive: if not section exists then section exists??

Secondly I'd suggest being able to load the inifile into a global variable and never have to use it again, rather than passing ${ini_data} for every read or test, perhaps adding simple wrappers for the get/list functions that use the preloaded data. Just an idea...

Also generally INI files sections and keys are case-insensitive, not a deal breaker but an item of note.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working documentationImprovements or additions to documentation good first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /