1 2 3 4 5
#!/bin/zsh (($+xtrace)) && (($xtrace)) && set -x awk -v RX="^${0:a:h}/" '$2 ~ RX {print $2}' /proc/mounts | sort -r | while IFS= read; do umount $REPLY || exit $? done