]> git.plutz.net Git - clickslide/commitdiff
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 f5a0ac6c58feb4de7ae8285b32f28e4b4c47780d..8bd1b952dc54b1a9891772b2a03a01581f0a1d74 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;
   '
 }