Add blackbox_less. (#263)

* Add blackbox_view and use PAGER (default to less)
This commit is contained in:
winter0mute
2018-07-26 16:24:32 +02:00
committed by Tom Limoncelli
parent ebaa22a981
commit 74de17a4f6
2 changed files with 21 additions and 0 deletions

20
bin/blackbox_view Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
#
# blackbox_view -- Decrypt a file, view it, shred it
#
set -e
source "${0%/*}/_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
${PAGER:-less} "$unencrypted_file"
if [[ $shreddable = 1 ]]; then
shred_file "$unencrypted_file"
fi
done