diff options
author | Gonzalo TornarĂa <tornaria@cmat.edu.uy> | 2022-02-20 13:22:31 -0300 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-02-21 14:44:55 +0100 |
commit | 5252576b7e23873baa7ec8f5164cae87bbda1b43 (patch) | |
tree | 39158c2a91cf5e4c90ec20b6e92a264ada64b47d | |
parent | 97b7b55dfdf2df95f37e46625202aa9a8cf1ffc8 (diff) | |
download | xtools-5252576b7e23873baa7ec8f5164cae87bbda1b43.tar.gz xtools-5252576b7e23873baa7ec8f5164cae87bbda1b43.tar.xz xtools-5252576b7e23873baa7ec8f5164cae87bbda1b43.zip |
xlint: fix bug in previous commit
In scan() I was using $argument in the sed script, but oftentimes $arguments is a path including slashes which breaks havoc. Different way now, hopefully this is correct now. Note that $msg has to go through sed since some messages use `\2` to show the matching line.
-rwxr-xr-x | xlint | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/xlint b/xlint index 191d51e..422e367 100755 --- a/xlint +++ b/xlint @@ -7,9 +7,12 @@ export LC_ALL=C scan() { local rx="$1" msg="$2" - grep -P -Hn -e "$rx" "$template" | - grep -v -P -e "[^:]*:[^:]*:\s*#" | - sed "s/^[^:]*:\([^:]*\):\(.*\)/$argument:\1: $msg/" + grep -P -hn -e "$rx" "$template" | + grep -v -P -e "[^:]*:\s*#" | + sed "s/^\([^:]*\):\(.*\)/\1: $msg/" | + while read line; do + echo "$argument:$line" + done } once() { |