#!/bin/bash if [ -z "$1" ]; then echo "Usage: $0 prefix" exit 1 fi set -eu PREFIX="$1" set -x if ls &> /dev/null "$PREFIX"/*; then umount "$PREFIX"/* || true rmdir "$PREFIX"/* || true fi rmdir "$PREFIX" || true