aboutsummaryrefslogtreecommitdiff
path: root/m
diff options
context:
space:
mode:
Diffstat (limited to 'm')
-rwxr-xr-xm17
1 files changed, 17 insertions, 0 deletions
diff --git a/m b/m
new file mode 100755
index 0000000..6b38cfc
--- /dev/null
+++ b/m
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test `ls /mnt | wc -l` -gt 0
+then
+ umount /mnt && echo Drive unmounted.
+ exit 0
+fi
+
+drv=`lsblk -o name,model | awk /"${1:-U3}"/' {getline; print substr($1, 7)}'`
+if test -z "$drv"
+then
+ echo "Drive '${1:-U3}' not found." 1>&2
+ exit 1
+fi
+
+mount /dev/$drv /mnt && echo Drive mounted. && exit 0
+exit 1