Files
blackbox/bin/blackbox_cat

22 lines
515 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
#
# blackbox_cat.sh -- Decrypt a file, cat it, shred it
#
set -e
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
2015-02-27 01:01:48 +07:00
source "${blackbox_home}/_blackbox_common.sh"
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