diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-12-01 23:49:01 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-12-01 23:49:01 +0300 |
commit | d03c206532d195e3d8f4d8db10de7694511c026f (patch) | |
tree | 96e6f44ebcdf7c3b34f59afe2a030c435000f5e9 | |
parent | d9e4285a19f250dcbac946e8665b3701c8859f91 (diff) | |
download | vsvs-d03c206532d195e3d8f4d8db10de7694511c026f.tar vsvs-d03c206532d195e3d8f4d8db10de7694511c026f.tar.xz vsvs-d03c206532d195e3d8f4d8db10de7694511c026f.zip |
.
-rwxr-xr-x[-rw-r--r--] | vsvs.sh | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -1,20 +1,24 @@ res="" met=false -while read line +while IFS="" read str do - value="$(echo -n "$line" | sed 's/ .*//')" - if [ "${line:0:1}" == " " ] + if [ -z "${str##* *}" ] then - if [ $met == true ] - then - res="${res}\n${value}" - fi + key="${str%% *}" + val="${str#* }" else - if [ "$(echo -n "${line}" | sed 's/[^ ]* //')" == "$1" ] - then - met=true - res="${value}" - fi + key="${str}" + val="" + fi + if [ -z "${key}" ] && [ $met == true ] + then + res="${res}"$'\n'"${val}" + elif [ "${key}" == "$1" ] + then + met=true + res="${val}" + else + met=false fi done echo -n "${res}" |