From 9f0ada4bedb278a275180dd769d8ec8ce0c1d4b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Wed, 9 Mar 2022 13:53:37 +0100 Subject: [PATCH] scripts: sd_fusing_rpi3: remove unnecessary grep calls MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Handle pattern matching with awk instead of grep. Change-Id: I7377e578987dc77f0f22d0083630acd5888eff66 Signed-off-by: Łukasz Stelmach --- scripts/tizen/sd_fusing_rpi3.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tizen/sd_fusing_rpi3.sh b/scripts/tizen/sd_fusing_rpi3.sh index 62efa1352e..f102f63dcc 100755 --- a/scripts/tizen/sd_fusing_rpi3.sh +++ b/scripts/tizen/sd_fusing_rpi3.sh @@ -81,7 +81,7 @@ function fusing_image () { else local -r blktype=part fi - local -r device=/dev/`lsblk ${DEVICE} -o TYPE,KNAME | grep ${blktype} | awk '{ print $2 }' | grep -G "[a-z]${num}\$"` + local -r device=/dev/`lsblk ${DEVICE} -o TYPE,KNAME | awk "/^${blktype}.*[a-z]${num}\$/ { print \\\$2 }"` local -r bs=${PART_TABLE[${part_idx} * ${PART_TABLE_COL} + 2]} else echo "Not supported binary: $fusing_img" @@ -288,7 +288,7 @@ function mkpart_3 () { fi for ((idx=0;idx<$PART_TABLE_ROW;idx++)); do - local PART=/dev/`lsblk ${DISK} -o TYPE,KNAME | grep part | awk '{ print $2 }' | grep -G "[a-z]${PART_TABLE[$idx * ${PART_TABLE_COL} + 1]}\$"` + local PART=/dev/`lsblk ${DISK} -o TYPE,KNAME | awk "/^part.*[a-z]${PART_TABLE[$idx * ${PART_TABLE_COL} + 1]}\$/ { print \\\$2 }"` if [ "${PART_TABLE[$idx * ${PART_TABLE_COL} + 4]}" == "vfat" ]; then mkfs.vfat -F 16 ${PART} -n ${PART_TABLE[$idx * ${PART_TABLE_COL} + 3]} if [ $? -eq 1 ]; then -- 2.34.1