Skip to content

Instantly share code, notes, and snippets.

@cakyus
Last active August 29, 2015 14:05
Show Gist options
  • Save cakyus/ba5c514565dfe3d6fd46 to your computer and use it in GitHub Desktop.
Save cakyus/ba5c514565dfe3d6fd46 to your computer and use it in GitHub Desktop.
Auto-mount unmounted devices
#!/bin/sh
for DEVICE_PATH in `ls -1 /dev/sd*[1,2,3,4,5,6,7,8,9]`
do
DEVICE_IS_MOUNTED=`mount | grep $DEVICE_PATH | wc -l`
if [ $DEVICE_IS_MOUNTED = 1 ]
then
# skip mounted device
continue
fi
udisks --mount $DEVICE_PATH
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment