#!/bin/sh -euf usage() ( echo "backup-all.sh [duplicity options]" echo echo "Backups each dataset listed in the given file using Duplicity," echo "each line of the file being a pair of a dataset name and a Duplicity destination URI." echo ) backup_all() ( LIST_FILE="$1" DUPLICITY_OPTIONS="$2" grep -v '^\s*#' "$LIST_FILE" | while read -r LINE; do backup-dataset.sh $LINE $DUPLICITY_OPTIONS done ) case "${1:-help}" in "help") usage;; *) backup_all "$1" "${2:-}";; esac