escape spaces in stored data for easyer use with `read`
authorPaul Hänsch <paul@plutz.net>
Sun, 15 Jul 2018 19:06:28 +0000 (21:06 +0200)
committerPaul Hänsch <paul@plutz.net>
Sun, 15 Jul 2018 19:06:28 +0000 (21:06 +0200)
storage.sh

index f5a0ac6..8bd1b95 100755 (executable)
@@ -68,6 +68,8 @@ STRING(){
     s;\n;\\n;g;
     s;\t;\\t;g;
     s;\r;\\r;g;
+    s;\+;\\+;g;
+    s; ;+;g;
   '
 }
 
@@ -77,7 +79,9 @@ UNSTRING(){
     s;((^|[^\\])(\\\\)*)\\n;\1\n;g;
     s;((^|[^\\])(\\\\)*)\\t;\1\t;g;
     s;((^|[^\\])(\\\\)*)\\r;\1\r;g;
+    s;((^|[^\\])(\\\\)*)\+;\1 ;g;
     tX;
+    s;((^|[^\\])(\\\\)*)\\\+;\1+;g;
     s;\\\\;\\;g;
   '
 }