Browse Source

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 years ago
parent
commit
a59d6491e2
1 changed files with 1 additions and 4 deletions
  1. 1
    4
      src/ffoo/saturnin_urimagic.sh

+ 1
- 4
src/ffoo/saturnin_urimagic.sh View File

@@ -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