Fix spaces in drive model causing issues.

This commit is contained in:
natemaia 2020-04-26 07:34:39 -07:00
parent f16d682856
commit e79981bdbe

View File

@ -7,7 +7,7 @@
# shellcheck disable=SC2086,SC2046,SC2254 # shellcheck disable=SC2086,SC2046,SC2254
VER=2.1.36 VER=2.1.37
# default values { # default values {
@ -995,9 +995,9 @@ part_pretty()
isize=${s:0:-1} isize=${s:0:-1}
isize=${isize%.*} isize=${isize%.*}
if [[ $dev = /dev/nvme* ]]; then if [[ $dev = /dev/nvme* ]]; then
model=$(lsblk -lno MODEL "${dev%p[1-9]}") model=$(lsblk -lno MODEL "${dev%p[1-9]}" | awk '{gsub(/ /, "_"); print}')
else else
model=$(lsblk -lno MODEL "${dev%[1-9]}") model=$(lsblk -lno MODEL "${dev%[1-9]}" | awk '{gsub(/ /, "_"); print}')
fi fi
[[ $size_t == 'K' || ($size_t == 'M' && $isize -lt 80) ]] || printf "%s\n" "$dev ${size}__$model" [[ $size_t == 'K' || ($size_t == 'M' && $isize -lt 80) ]] || printf "%s\n" "$dev ${size}__$model"
done < <(lsblk -lno TYPE,PATH,SIZE,FSTYPE,LABEL $part | done < <(lsblk -lno TYPE,PATH,SIZE,FSTYPE,LABEL $part |