Parse line instead of file in get_pos()
authorHugo Villeneuve <hugo@hugovil.com>
Thu, 30 Nov 2023 23:28:25 +0000 (18:28 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Thu, 30 Nov 2023 23:29:57 +0000 (18:29 -0500)
fgen.sh

diff --git a/fgen.sh b/fgen.sh
index c4c6fe9..62c636d 100755 (executable)
--- a/fgen.sh
+++ b/fgen.sh
@@ -65,10 +65,12 @@ function get_size()
     cat ${layers} | grep -m 1 "${1}" | ${SED} "s/.*geometry:\([0-9]\+x[0-9]\+\).*/\1/g"
 }
 
-# Arg1: layer
+# Arg1: line
 function get_pos()
 {
-    cat ${layers} | grep "${1}" | ${SED} "s/.*geometry:[0-9]\+x[0-9]\+\([+-][0-9]\+[+-][0-9]\+\),.*/\1/g"
+    local token
+    token=$(echo "${1}" | ${SED} "s/.*geometry:[0-9]\+x[0-9]\+\([+-][0-9]\+[+-][0-9]\+\),.*/\1/g")
+    echo "${token}"
 }
 
 # Arg1: line