Created
April 16, 2015 17:38
-
-
Save nk23x/7deab28a4b8f7e033cd1 to your computer and use it in GitHub Desktop.
mount usb devices by uuid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo >> /etc/fstab | |
for d in $@; do | |
mkdir /mnt/usb/$(blkid ${d}|perl -pe 's/(.*)UUID=\"(.*)\" TYPE=\"(.*)\"/$2/g;') | |
echo "$(blkid ${d}|perl -pe 's/(.*)UUID=\"(.*)\" TYPE=\"(.*)\"/UUID=$2 \/mnt\/usb\/$2 $3 defaults,rw 1 1/g;')" >> /etc/fstab | |
done | |
mount -av | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment