Created
April 26, 2016 14:24
-
-
Save jacaetevha/0fe5353651a44b45f4ca5755599ae52b to your computer and use it in GitHub Desktop.
BASH script to en-/decrypt a file with GPG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" == "--encode" ] | |
then | |
FILE=${2:-private.tar} | |
gpg --output $FILE.enc --symmetric --cipher-algo AES256 $FILE | |
elif [ "$1" == "--decode" ] | |
then | |
FILE=${2:-private.tar.enc} | |
FILE_BASENAME=$(basename ${FILE%.*}) | |
gpg --output $FILE_BASENAME --decrypt $FILE | |
else | |
echo "$0 [--encode | --decode]" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment