Skip to content

Instantly share code, notes, and snippets.

@emasaka
Created March 1, 2012 14:04
Show Gist options
  • Save emasaka/1950013 to your computer and use it in GitHub Desktop.
Save emasaka/1950013 to your computer and use it in GitHub Desktop.
#!/bin/bash
udisks --monitor | while read ev; do
if [[ "$ev" == changed:* ]]; then
dev=${ev##*/}
if [[ "$dev" == *_* ]]; then
dev=$(echo -e ${dev//_/\\x}) # "_2d" -> "-"
fi
mp=$(udisks --show-info "/dev/$dev" | sed -n '/^ mount paths: */{s///;p}')
if [ -n "$mp" ]; then
notify-send mounted "$dev -> $mp"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment