Skip to content

Instantly share code, notes, and snippets.

@AaronJackson
Created August 29, 2013 20:11
Show Gist options
  • Save AaronJackson/6382832 to your computer and use it in GitHub Desktop.
Save AaronJackson/6382832 to your computer and use it in GitHub Desktop.
Quick and messy bash script for viewing plain text files encrypted with GPG
#!/bin/bash
GPG_ID=`gpg --list-secret-keys | grep "sec " | awk '{ print $2 }' | awk -F '/' '{ print $2 }'`
DATA=`cat $1 | gpg -d -r $GPG_ID`
clear
printf '%*s\n\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo "$DATA"
unset DATA
printf '\n\n%*s\n\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo "Press any key to clear this screen"
read -n 1 -s
clear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment