Allow `partvis` to take stdin

master
BrainwreckedTech 3 years ago
parent 3d3613d766
commit 904a412930

@ -20,9 +20,11 @@ sectors_to_size() {
[ $EUID -gt 0 ] && echo "Must run as superuser." && exit 1 [ $EUID -gt 0 ] && echo "Must run as superuser." && exit 1
for DEVICE in $(fdisk -l | grep '^Disk /' | grep -v '/dev/ram' | cut -d\ -f2 | cut -d: -f1); do [ -t 0 ] && DEVLIST="$(fdisk -l)" || DEVLIST="$(cat -)"
FDISKDATA="$(fdisk -l "${DEVICE}")" for DEVICE in $(echo "${DEVLIST}" | grep '^Disk /' | grep -v '/dev/ram' | cut -d\ -f2 | cut -d: -f1); do
[ -t 0 ] && FDISKDATA="$(fdisk -l "${DEVICE}")" || FDISKDATA="${DEVLIST}"
COLS="$(tput cols)" COLS="$(tput cols)"
SECTORS="$(echo "${FDISKDATA}" | grep sectors | grep -v 'sectors of' | rev | cut -d\ -f2 | rev)" SECTORS="$(echo "${FDISKDATA}" | grep sectors | grep -v 'sectors of' | rev | cut -d\ -f2 | rev)"
#PARTLIST="$(echo "${FDISKDATA}" | grep '^/' | sed 's/ */ /g' | cut -d\ -f1-3)" #PARTLIST="$(echo "${FDISKDATA}" | grep '^/' | sed 's/ */ /g' | cut -d\ -f1-3)"

Loading…
Cancel
Save