Files
blackbox/bin/blackbox_cat

21 lines
435 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
#
# blackbox_cat -- Decrypt a file, cat it, shred it
#
set -e
source "${0%/*}/_blackbox_common.sh"
2015-06-12 13:27:42 -05:00
for param in "$@" ; do
2014-11-12 00:56:28 -08:00
shreddable=0
unencrypted_file=$(get_unencrypted_filename "$param")
2014-11-12 00:56:28 -08:00
if [[ ! -e "$unencrypted_file" ]]; then
"${BLACKBOX_HOME}/blackbox_edit_start" "$param"
2014-11-12 00:56:28 -08:00
shreddable=1
fi
cat "$unencrypted_file"
if [[ $shreddable = 1 ]]; then
shred_file "$unencrypted_file"
fi
done