From 9aa95c3f47b0ed8fb50c1d96de05261b273d2cf5 Mon Sep 17 00:00:00 2001 From: Marex Date: Fri, 3 May 2024 09:49:24 +0200 Subject: [PATCH] docs: simplify the find_version script and fix shellcheck report in it (#6133) Signed-off-by: Marek Vasut Co-authored-by: Marek Vasut --- scripts/find_version.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/find_version.sh b/scripts/find_version.sh index 8f6e43395..d3a39d01b 100755 --- a/scripts/find_version.sh +++ b/scripts/find_version.sh @@ -1,8 +1,4 @@ -#!/bin/bash -# Credit: https://stackoverflow.com/a/4774063 -SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -TMPENVFILE=$(mktemp /tmp/lvgl.script.XXXXXX) -cat $SCRIPTPATH/../lv_version.h | grep "#define LVGL_VERSION_" | sed 's/#define //g' | sed -r 's/\s+/=/' > $TMPENVFILE -. $TMPENVFILE -rm $TMPENVFILE -echo $LVGL_VERSION_MAJOR.$LVGL_VERSION_MINOR +#!/bin/sh + +SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P )" +sed -n '/LVGL_VERSION_MAJOR/ {N;s@#define \+LVGL_VERSION_M.... \+@@g;s@\n@.@p}' "$SCRIPTPATH/../lv_version.h"