Skip to content

Instantly share code, notes, and snippets.

@weirane
Created December 29, 2019 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weirane/d3eea2b74d31b4da5ae9b5f7b41c33ab to your computer and use it in GitHub Desktop.
Save weirane/d3eea2b74d31b4da5ae9b5f7b41c33ab to your computer and use it in GitHub Desktop.
Mount drives using dmenu
#!/bin/sh
chosen=$(lsblk -rnpo "name,label,size,type,mountpoint" |
awk '/part $/ { printf "%s %s (%s)\n",$1,$2,$3 }' |
dmenu -i -l 10 -p "Mount which drive?" |
cut -d' ' -f1)
if [ $? = 0 ] && [ -n "$chosen" ]; then
msg=$(udisksctl mount -b $chosen)
notify-send '💻 Mount' "$msg"
else
echo "Abort"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment