#!/bin/sh if test `id -u` -ne 0 then echo "$0 must be run as root." return fi ROOT=test_environment cleanup_mount() { if mountpoint "$1" > /dev/null then echo "Unmounting $1" umount "$1" fi } if test -e "$ROOT" then cleanup_mount "$ROOT/proc" cleanup_mount "$ROOT/sys" echo "Removing $ROOT" rm -r "$ROOT" else echo "No environment found at $ROOT. Doing nothing." fi