Ver código fonte

Fix and simplify kw/query code

Old code had problems with trailing space--which did not manifest itself
until now when I tried to use infix query (e.g. 'foo%sbar' would always
result in space after '%s').

Turns out that `read` with multiple variables splits the line just as we
need it with no extra leading/trailing junk.
Alois Mahdal 9 anos atrás
pai
commit
a59d6491e2
1 arquivos alterados com 1 adições e 4 exclusões
  1. 1
    4
      src/ffoo/saturnin_urimagic.sh

+ 1
- 4
src/ffoo/saturnin_urimagic.sh Ver arquivo

@@ -67,11 +67,8 @@ __saturnin_urimagic__deref() {
67 67
     local query     # query part,   eg. "hello dolly"   or "1234"
68 68
     local pfx0=$saturnin_urimagic__inipfx0
69 69
     local pfxN=$saturnin_urimagic__inipfxN
70
-    while read line;
70
+    while read kw query;
71 71
     do
72
-        line="$line "
73
-        kw=${line%% *}
74
-        query=${line#$kw }
75 72
         debug -v kw query
76 73
         if test -n "$query";
77 74
         then