summaryrefslogtreecommitdiff
path: root/vsvs-parse
blob: c06e777277d16fd2df43dbabdf0772e76f590d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# Iterate action over elements from VSVS input,
# action is passed as $1, it will be evaluated for each key-value pair.
after () { test -z "${2##*$1*}" && echo -n "${2#*$1}"; }
key=""
value=""
while IFS="" read line
do
    if test -z "${line%% *}"
    then value="${value}"$'\n'"$(after " " "$line")"
    else
        eval $1
        key="${line%% *}"
        value="$(after " " "$line")"
    fi
done
eval $1