From cdf2eba176a6daf6d3f151601c414e048b20d6e3 Mon Sep 17 00:00:00 2001 From: BrainwreckedTech <3752022+BrainwreckedTech@users.noreply.github.com> Date: Tue, 28 Dec 2021 04:32:58 -0500 Subject: [PATCH] Make bdmap changes POSIX-sh compliant --- bdmap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bdmap b/bdmap index 5127f62..ab59c7f 100755 --- a/bdmap +++ b/bdmap @@ -15,15 +15,15 @@ OUTPUT="$(echo "${OUTPUT}" | sed 's|target[0-9:]\+/[0-9:]\+:\([0-9]\+\)|target\1 # STRIP OFF BLOCKS OUTPUT="$(echo "${OUTPUT}" | sed 's|/block/.*||g')" -# CONVERT -> TO A TAB -OUTPUT="${OUTPUT// -> / }" +# CONVERT -> TO A SPACE +OUTPUT="$(echo "${OUTPUT}" | sed 's/ -> / /g')" # SWAP COLUMNS OUTPUT="$(echo "${OUTPUT}" | awk '{t=$1; $1=$2; $2=t; print;}')" # NOW GET DEVICE IDs -while read -r LOCATION BLOCKDEV; do +echo "${OUTPUT}" | while read -r LOCATION BLOCKDEV; do DEVICE_ID="$(ls -l --color=never /dev/disk/by-id | sed 's/ \+/ /g' | grep -v 'nvme-eui\|wwn-' | grep "${BLOCKDEV}$" | cut -d\ -f9)" echo "${LOCATION} ${BLOCKDEV} ${DEVICE_ID}" -done <<< "${OUTPUT}" +done