aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2022-12-14 10:58:31 +0100
committerMatěj Cepl <mcepl@cepl.eu>2022-12-14 10:58:31 +0100
commit73fe33be72d2d22d90a0640e6e79d1e12ed69aa0 (patch)
tree63fd2fbc93ac94336bc6445644163a843d2cb591
parent15fb74ea27ab4f012a3afa9e221c32c5b0883ff8 (diff)
downloadtime-of-build-73fe33be72d2d22d90a0640e6e79d1e12ed69aa0.tar.gz
Make shellcheck and checkbashisms happy.
-rwxr-xr-xtime-of-build.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/time-of-build.sh b/time-of-build.sh
index 825a065..0ac4016 100755
--- a/time-of-build.sh
+++ b/time-of-build.sh
@@ -8,8 +8,9 @@ trap 'rm -rf "$tempfile"' EXIT
osc rbl $projname $pkg openSUSE_Tumbleweed x86_64 >$tempfile
# begtime="Tue Dec 13 23:50:13 UTC 2022"
-begstr="$(sed -E -n -e '/started "build/s/^.*at (.*)\.$/\1/p' $tempfile)"
-endstr="$(sed -E -n -e '/(finished|failed) "build/s/^.*at (.*)\.$/\1/p' $tempfile)"
+# \x22 is " character; https://unix.stackexchange.com/a/230354/184648
+begstr="$(sed -E -n -e '/started \x22build/s/^.*at (.*)\.$/\1/p' $tempfile)"
+endstr="$(sed -E -n -e '/(finished|failed) \x22build/s/^.*at (.*)\.$/\1/p' $tempfile)"
begtime="$(date --date "$begstr" +%s)"
endtime="$(date --date "$endstr" +%s)"
-echo -e "$(( $endtime - $begtime ))\t$pkg"
+printf "%s\t%s\n" $(( endtime - begtime )) $pkg