Skip to content

Instantly share code, notes, and snippets.

@jakeonfire
Last active August 29, 2015 14:24
Show Gist options
  • Save jakeonfire/9bf7ff1b08ed2c76fefc to your computer and use it in GitHub Desktop.
Save jakeonfire/9bf7ff1b08ed2c76fefc to your computer and use it in GitHub Desktop.
#!/bin/bash
tempfile=tempfile
if [ $# != 1 ]; then
echo "usage: ./gpg-edit filename.gpg"
exit 1
fi
cp $1 .$1.bak
set -e
set -o pipefail
gpg --decrypt --quiet $1 | vipe | gpg --encrypt --recipient jacob --output $tempfile --yes
exitstatus=$?
if [ $exitstatus == 0 ]; then
mv $tempfile $1
echo success
else
rm -f $tempfile
echo failed
exit $exitstatus
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment