1 2 3
#!/bin/zsh set -x awk -v RX="^${0:a:h}/" '$2 ~ RX {print $2}' /proc/mounts | sort -r | xargs umount