#! /bin/sh jailName="$1" if ! zfs list zroot/jails/$jailName then echo " dataset zroot/jails/$jailName does not exists " exit fi service jail stop $jailName read -p "Are you sure you want to delete $jailName ? " REPLY echo # (optional) move to a new line if [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ] then zfs destroy zroot/jails/$jailName sleep 2 rmdir /jails/$jailName fi