Last active
August 29, 2015 14:27
-
-
Save alekratz/fed9fb9db081637d4138 to your computer and use it in GitHub Desktop.
encrypt/decrypt cat
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
# copy and paste these into your ~/.bashrc or whatever you source on terminal startup | |
# for the lazy bash users: | |
# $ curl https://gist.githubusercontent.com/alekratz/fed9fb9db081637d4138/raw | grep '^[^#]' >> ~/.bashrc | |
# for the lazy zsh users: | |
# $ curl https://gist.githubusercontent.com/alekratz/fed9fb9db081637d4138/raw | grep '^[^#] >> ~/.zshrc | |
function encat() { | |
case $# in | |
0) | |
echo "usage: $0 file [ file ... ]" | |
return 1 | |
;; | |
1) | |
gpg -a -r YOUR_KEY_ID --encrypt < $1 | |
;; | |
*) | |
for f in $@; do | |
echo "$f:" | |
gpg -a -r YOUR_KEY_ID --encrypt < $f | |
done | |
esac | |
} | |
function decat() { | |
case $# in | |
0) | |
echo "usage: $0 file [ file ... ]" | |
return 1 | |
;; | |
1) | |
gpg -a --decrypt < $1 | |
;; | |
*) | |
for f in $@; do | |
echo "$f:" | |
gpg -a --decrypt < $f | |
done | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment