Browse Source

Add lssect to list all sections from mkit.ini

Alois Mahdal 7 years ago
parent
commit
b6452cd988
1 changed files with 9 additions and 0 deletions
  1. 9
    0
      src/include/ini.sh

+ 9
- 0
src/include/ini.sh View File

93
     __ini_grepsec "$sct" | cut -d= -f1 | awk '!x[$0]++'
93
     __ini_grepsec "$sct" | cut -d= -f1 | awk '!x[$0]++'
94
 }
94
 }
95
 
95
 
96
+__ini_lssect() {
97
+    #
98
+    # List all section names
99
+    #
100
+    local arg=$1    # unused argument
101
+    grep -x '\[.*\]' | sed 's/^.//; s/.$//'
102
+}
103
+
96
 __ini_maybe_expand() {
104
 __ini_maybe_expand() {
97
     #
105
     #
98
     # Decide whether or not to expand
106
     # Decide whether or not to expand
114
     local limit=__ini_cat    # limiting internal function
122
     local limit=__ini_cat    # limiting internal function
115
     case $op in
123
     case $op in
116
         lskeys) fn=__ini_lskeys   ;;
124
         lskeys) fn=__ini_lskeys   ;;
125
+        lssect) fn=__ini_lssect   ;;
117
         sec)    fn=__ini_grepsec  ;;
126
         sec)    fn=__ini_grepsec  ;;
118
         values) fn=__ini_greppath ;;
127
         values) fn=__ini_greppath ;;
119
         1value) fn=__ini_greppath; limit="tail -1" ;;
128
         1value) fn=__ini_greppath; limit="tail -1" ;;