1 2 3 4 5 6 7
[[ $# -ne 2 ]] && \ die "usage: $0 <source directory> <directory to create>" [[ -a $2 ]] && \ die "$1 already exists" [[ -d $1 ]] || \ die "$1 is not valid directory" btrfs subvolume snapshot $1 $2 || die "btrfs snapshot failed"