summaryrefslogtreecommitdiff
path: root/vsvs-parse
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-12-06 17:51:22 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-12-06 17:51:22 +0300
commitc8550c2ba6bc3f80cbad499a6997d0b903580599 (patch)
tree5be0fd2eeafaae659fe476500ddf588d995b9e61 /vsvs-parse
parentfc148d0a1e8fed57f097a0a1e0c6d84641132de7 (diff)
downloadvsvs-c8550c2ba6bc3f80cbad499a6997d0b903580599.tar
vsvs-c8550c2ba6bc3f80cbad499a6997d0b903580599.tar.xz
vsvs-c8550c2ba6bc3f80cbad499a6997d0b903580599.zip
.
Diffstat (limited to 'vsvs-parse')
-rw-r--r--vsvs-parse17
1 files changed, 17 insertions, 0 deletions
diff --git a/vsvs-parse b/vsvs-parse
new file mode 100644
index 0000000..c06e777
--- /dev/null
+++ b/vsvs-parse
@@ -0,0 +1,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