#!/bin/sh TODAY=`date "+%y%m%d"` ZROOT="zroot" ZFS="/sbin/zfs " # Seven day ago # ------------- SEVEND=`date -j -v"-7d" +"%s"` IFS=$'\n' for i in `zfs list -Hp -t snap -o name,creation -s creation` do # caution: tab is the separator SNAPCREATED=${i##* } di=`expr ${SNAPCREATED} - ${SEVEND}` [ ${SNAPCREATED} -lt ${SEVEND} ] && echo "${i%% *} is more than 7 days old" done