From 98f01e0342af4a4ef4f026552d793c96e4976b86 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Thu, 30 Nov 2023 18:28:25 -0500 Subject: [PATCH] Parse line instead of file in get_pos() --- fgen.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fgen.sh b/fgen.sh index c4c6fe9..62c636d 100755 --- 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 -- 2.20.1