diff options
| author | davidovski <david@davidovski.xyz> | 2026-10-01 10:34:33 +0100 |
|---|---|---|
| committer | davidovski <david@davidovski.xyz> | 2026-10-01 10:34:33 +0100 |
| commit | eca55e60c29440c4e2e007b54ea1a1983e965954 (patch) | |
| tree | a98173c09f69864cc25395bfdab67d682434854b /src/util/parseconf.sh | |
| parent | f20bd9d6369c2e1246dcdd4af26b085da99c18e0 (diff) | |
Diffstat (limited to 'src/util/parseconf.sh')
| -rw-r--r-- | src/util/parseconf.sh | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/util/parseconf.sh b/src/util/parseconf.sh index d215a99..17cb0ce 100644 --- a/src/util/parseconf.sh +++ b/src/util/parseconf.sh @@ -1,37 +1,37 @@ #!/bin/sh usage () { - printf "Usage $0 " - echo << "EOF" +printf "Usage $0 " +echo << "EOF" OPTIONS... [FILTER] Print the parsed config file filtering by the keys Arguments: - -f file read configuration from a file, uses /dev/sdtin otherwise - -v only print values - -c n print the last [n] +-f file read configuration from a file, uses /dev/sdtin otherwise +-v only print values +-c n print the last [n] EOF } # parse a single config file line # parse_line() { - [ "$#" = 0 ] && return - - local line="$@" - local key=$1 - - shift - local value="$@" - value=${value%#*} - - case $key in - "include") - cat $value | parse - return - ;; - "]") - IFS=. +[ "$#" = 0 ] && return + +local line="$@" +local key=$1 + +shift +local value="$@" +value=${value%#*} + +case $key in + "include") + cat $value | parse + return + ;; + "]") + IFS=. set -- $list list="${*%${!#}}" IFS=" " |
