From 02500565fa852dba828e9de91f34559cc0e41b1c Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Sun, 25 Nov 2018 02:22:00 +0100 Subject: Mount scripts now use a dmenu numbered list --- dmenuUmount.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'dmenuUmount.sh') diff --git a/dmenuUmount.sh b/dmenuUmount.sh index f50f4aa..ecc5160 100644 --- a/dmenuUmount.sh +++ b/dmenuUmount.sh @@ -1,5 +1,5 @@ #!/bin/bash -# _ _ +# _ # __| |_ __ ___ ___ _ __ _ _ # / _` | '_ ` _ \ / _ \ '_ \| | | | # | (_| | | | | | | __/ | | | |_| | @@ -14,10 +14,17 @@ # Shows mounted partitions; select one to unmount. exclusionregex="\(/boot\|/home\|/\)$" -drives=$(lsblk -lp | grep "part /" | grep -v "$exclusionregex" | awk '{print $1, "(" $4 ")", "on", $7}') +drives="" +i=0 +while read -r line +do + i=$((i+1)) + drives="$drives$i. $( echo "$line" | awk '{print $1, "(" $4 ")", "on", $7}' )"$'\n' +done <<< "$(lsblk -lp | grep "part /" | grep -v "$exclusionregex" )" + [[ "$drives" = "" ]] && exit lines=$(echo "$drives" | wc -l) -chosen=$(echo "$drives" | dmenu -i -l $lines -p "Unmount which drive?" | awk '{print $1}') +chosen=$(echo "$drives" | dmenu -i -l $lines -p "Unmount which drive?" | awk '{print $2}') [[ "$chosen" = "" ]] && exit umount $chosen && pgrep -x dunst && notify-send "$chosen unmounted." #umount $chosen && notify-send "$chosen unmounted." -- cgit v1.2.1