Reduce Redundant lsblk Calls #16
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Called multiple times for same device
size=$(lsblk -d -n -o SIZE "/dev/$device" 2>/dev/null)
mountpoint=$(lsblk -n -o MOUNTPOINT "/dev/$name" 2>/dev/null)
Optimization: Single call with multiple columns:
read -r size mountpoint type < <(lsblk -d -n -o SIZE,MOUNTPOINT,TYPE "/dev/$device")