blackbox_edit and blackbox_cat use other blackbox scripts internally,
but assume that they will be found on $PATH. In testing it's useful to
be able to run these scripts by pathname without first putting them on
$PATH, and all the other scripts work just fine in these circumstances.
This edit fixes this by prefixing all references to other scripts in
blackbox_edit and blackbox_cat with ${blackbox_home}, which is conveniently
set as part of sourcing _blackbox_common.sh.
22 lines
515 B
Bash
Executable File
22 lines
515 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
#
|
|
# blackbox_cat.sh -- Decrypt a file, cat it, shred it
|
|
#
|
|
set -e
|
|
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
source "${blackbox_home}/_blackbox_common.sh"
|
|
|
|
for param in """$@""" ; do
|
|
shreddable=0
|
|
unencrypted_file=$(get_unencrypted_filename "$param")
|
|
if [[ ! -e "$unencrypted_file" ]]; then
|
|
"${blackbox_home}/blackbox_edit_start" "$param"
|
|
shreddable=1
|
|
fi
|
|
cat "$unencrypted_file"
|
|
if [[ $shreddable = 1 ]]; then
|
|
shred_file "$unencrypted_file"
|
|
fi
|
|
done
|