#!/bin/bash
# mount - ``mount`` Tool Support
######
# ``mount`` Support
# is_mounted() - Returns success if mount point ($1) is mounted.
# $1 - Path to mount point
is_mounted() {
has_args 1 "$@"
mount | grep " $1 " >/dev/null
}
# run_mount() - Mounts something ($1) to the named mount point ($2).
# The mount point will be created if it does not exist.
# $1 - thing to mount
# $2 - Path to mount point
run_mount() {
min_args 2 "$@"
local mnt="${@[-1]}"
[ -d "$mnt" ] || run_sudo mkdir -p "$mnt"
run_sudo mount "$@"
}
# run_umount() - Unmounts the named mount point ($1)
# $1 - Path to mount point
run_umount() {
has_args 1 "$@"
local mnt=$1
if is_mounted "$mnt"; then
run_sudo umount "$mnt"
else
warn "$mnt: not mounted"
fi
}
Generated on Fri Jul 28 14:36:10 PDT 2017 by mcsh d14 v0.23.0.