]> git.wh0rd.org - home.git/blame - .bin/umount-tree
add umount-tree helper
[home.git] / .bin / umount-tree
CommitLineData
aaf997b4
MF
1#!/bin/bash
2
3root=$1
4if [[ -z $1 ]] ; then
5 echo "Usage: $0 <root>"
6 exit 1
7fi
8
9mounts=$(mount | grep " on ${root%/}/" | awk '{print $3}' | tac)
10if [[ -z ${mounts} ]] ; then
11 echo "No mounts found ..."
12 echo
13 mount
14 exit 0
15fi
16
17echo "Unmounting: "
18printf '\t%s\n' ${mounts}
19
20printf "OK? [y/N] "
21read v
22[[ ${v} == "y" ]] && sudo umount -v ${mounts}