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