#!/bin/sh # (c) copyright 2010 by Thomas Tanner test "$#" -eq 0 && echo "$0 destination" && exit 1 later= for d in `cat /proc/mounts | grep " $1/" | awk '{ print $2}'`; do case $d in $1/dev/pts|$1/dev/shm|$1/home/user/MyDocs) #echo unmounting $d umount $d ;; *) later="$later $d" ;; esac done for d in $later; do #echo unmounting $d umount $d done