bugfix, STRING and UNSTRING input like "foo[bar]" master
authorPaul Hänsch <paul@plutz.net>
Wed, 29 Jan 2020 18:03:50 +0000 (19:03 +0100)
committerPaul Hänsch <paul@plutz.net>
Wed, 29 Jan 2020 18:03:50 +0000 (19:03 +0100)
storage.sh

index d84f0c2..7f70e64 100755 (executable)
@@ -91,7 +91,7 @@ STRING(){
     "  "*) out="${out}\\t"; in="${in#  }" ;;
     +*) out="${out}\\+"; in="${in#+}" ;;
     " "*) out="${out}+"; in="${in# }" ;;
-    *) out="${out}${in%%[\\${CR}${BR}  + ]*}"; in="${in#${in%%[\\${BR}${CR}    + ]*}}" ;;
+    *) out="${out}${in%%[\\${CR}${BR}  + ]*}"; in="${in#"${in%%[\\${BR}${CR}   + ]*}"}" ;;
   esac; done
   printf '%s' "$out"
 }
@@ -122,7 +122,7 @@ UNSTRING(){
     \\+) out="${out}+"; in="${in#\\+}" ;;
     +*) out="${out} "; in="${in#+}" ;;
     \\*) in="${in#\\}" ;;
-    *) out="${out}${in%%[\\+]*}"; in="${in#${in%%[\\+]*}}" ;;
+    *) out="${out}${in%%[\\+]*}"; in="${in#"${in%%[\\+]*}"}" ;;
   esac; done
   printf '%s' "$out"
 }