From c1acfc730a50fe8049742ac0c2465db631262aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 31 Oct 2020 00:06:23 +0100 Subject: Add 'm' mount tool --- m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 m 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 -- cgit v1.2.3