[explorer/disks] Move xargs call to the bottom

This commit is contained in:
Dennis Camera 2020-02-23 23:08:40 +01:00
parent d3bd2669ec
commit 1ef126e16f

View file

@ -7,13 +7,12 @@ case $uname_s in
sysctl -n kern.disks sysctl -n kern.disks
;; ;;
OpenBSD) OpenBSD)
sysctl -n hw.disknames | grep -Eo '[lsw]d[0-9]+' | xargs sysctl -n hw.disknames | grep -Eo '[lsw]d[0-9]+'
;; ;;
NetBSD) NetBSD)
PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
sysctl -n hw.disknames \ sysctl -n hw.disknames \
| awk 'BEGIN { RS = " " } /^[lsw]d[0-9]+/' \ | awk 'BEGIN { RS = " " } /^[lsw]d[0-9]+/'
| xargs
;; ;;
Linux) Linux)
# list of major device numbers toexclude: # list of major device numbers toexclude:
@ -23,7 +22,7 @@ case $uname_s in
if command -v lsblk >/dev/null 2>&1 if command -v lsblk >/dev/null 2>&1
then then
lsblk -e "$(echo "$ign_majors" | tr ' ' ',')" -dno name | xargs lsblk -e "$(echo "$ign_majors" | tr ' ' ',')" -dno name
elif test -d /sys/block/ elif test -d /sys/block/
then then
# shellcheck disable=SC2012 # shellcheck disable=SC2012
@ -34,8 +33,7 @@ case $uname_s in
getline devno < devfile getline devno < devfile
close(devfile) close(devfile)
if (devno !~ "^(" ign_majors "):") print if (devno !~ "^(" ign_majors "):") print
}' \ }'
| xargs
else else
echo "Don't know how to list disks on Linux without lsblk and sysfs." >&2 echo "Don't know how to list disks on Linux without lsblk and sysfs." >&2
echo 'If you can, please submit a patch.'>&2 echo 'If you can, please submit a patch.'>&2
@ -45,4 +43,5 @@ case $uname_s in
printf "Don't know how to list disks for %s operating system.\n" "${uname_s}" >&2 printf "Don't know how to list disks for %s operating system.\n" "${uname_s}" >&2
printf 'If you can please submit a patch\n' >&2 printf 'If you can please submit a patch\n' >&2
;; ;;
esac esac \
| xargs