# show labels and uuids of disk devices emulate -L zsh setopt extendedglob local -a -U disks local -A mountinfo disks=( /dev/disk/by-id/*(N@:A) ) if (( ${#disks} == 0 )); then printf 'No disks detected.\n' return 1 fi if [[ -r /proc/mounts ]]; then for cline in "${(f)$(}/${dev:t}/size(N) do print -f " Size: %.3f GiB (%d Byte)\n" \ $(($(<$sysdevsize)/(2.0*1024.0*1024.0))) \ $(($(<$sysdevsize)*512)) done print -f " Id: %s\n" /dev/disk/by-id/*(@e/'[[ ${REPLY:A} == $dev ]]'/N:t) done