#!/usr/bin/env bash set -eo pipefail NVAL=10 SECSIZE=10M Warn() { echo "Usage: cmd [-i] [-p] [-n]" 1>&2; exit 1 } while getopts ":i:o:n:" opt; do case "${opt}" in i ) Indir=$OPTARG;; o ) Outdir=$OPTARG;; n ) Archname=$OPTARG;; \? ) Warn ;; esac done [ -z $Indir ] && Warn [ -z $Outdir ] && Warn [ -z $Archname ] && Warn nice -n$NVAL \ tar cf - $Indir | \ bzip2 -c | \ gpg -c -o- | \ split -d -b$SECSIZE -a 3 - $Outdir/$Archname.tbz2.gpg-p