Skip to content

Instantly share code, notes, and snippets.

@dllud
Created February 19, 2014 02:59
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 dllud/9085286 to your computer and use it in GitHub Desktop.
Save dllud/9085286 to your computer and use it in GitHub Desktop.
pmount-all - script to (un)mount all USB disks' partitions using pmount.
#!/bin/bash
if [ "$1" != "mount" ] && [ "$1" != "umount" ]; then
echo "(Un)mounts all USB disks partitions. Usage: "
echo pmount-all mount
echo pmount-all umount
exit 0
fi
readarray sd < <(ls /dev | grep sd[b-z][1-9])
for ((i=0; i<${#sd[@]}; i++));
do
p$1 /dev/${sd[$i]}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment