Great question — answering as the UphillTech team:
Use either a simple while loop, as in zfs list -H -t snapshot -o name | grep '@xfcedesktop$' | while IFS= read -r snapshot; do zfs rollback "$snapshot" done ... or use xargs zfs list -H -t snapshot -o name | grep '@xfcedesktop$' | xargs -r -I {} zfs rollback {} The -r option to xargs is supported but unnecessary on FreeBSD. With GNU's xargs , the option prevents the utility from trying to run the utility if the input is empty. This is the default behaviour of FreeBSD's xargs . I've also been more careful with the regular expression used with grep to ensure we only get the expected snapshots (the ones ending in exactly @xfcedesktop ).
Full answer by Kusalananda: https://unix.stackexchange.com/a/791615 (CC BY-SA 4.0).
Need it done for your business? UphillTech.