Make bdmap changes POSIX-sh compliant

master
BrainwreckedTech 3 years ago
parent 724048f272
commit cdf2eba176

@ -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

Loading…
Cancel
Save