From: Mike Frysinger Date: Tue, 14 Feb 2012 21:22:35 +0000 (-0500) Subject: add umount-tree helper X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=aaf997b46057b6d3407056083edd76b56d98880e;p=home.git add umount-tree helper --- diff --git a/.bin/umount-tree b/.bin/umount-tree new file mode 100755 index 0000000..bcf866f --- /dev/null +++ b/.bin/umount-tree @@ -0,0 +1,22 @@ +#!/bin/bash + +root=$1 +if [[ -z $1 ]] ; then + echo "Usage: $0 " + exit 1 +fi + +mounts=$(mount | grep " on ${root%/}/" | awk '{print $3}' | tac) +if [[ -z ${mounts} ]] ; then + echo "No mounts found ..." + echo + mount + exit 0 +fi + +echo "Unmounting: " +printf '\t%s\n' ${mounts} + +printf "OK? [y/N] " +read v +[[ ${v} == "y" ]] && sudo umount -v ${mounts}