#!/bin/bash false while [ $? -ne 0 ]; do sudo true; done SEC=false for ARG in "$@"; do case "${ARG}" in "--secure") SEC=true ;; *) [[ -b "${ARG}" ]] && DVC+=("${ARG}") || ( echo "${ARG} is not a block device"; exit 1 ) ;; esac done echo -n "Filling ${DVC[@]} with " ${SEC} && echo "random data" || echo "zeros" for DEV in "${DVC[@]}"; do echo "${DEV}:" ${SEC} && openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt