Skip to content

Instantly share code, notes, and snippets.

@alekratz
Last active August 29, 2015 14:27
Show Gist options
  • Save alekratz/fed9fb9db081637d4138 to your computer and use it in GitHub Desktop.
Save alekratz/fed9fb9db081637d4138 to your computer and use it in GitHub Desktop.
encrypt/decrypt cat
# 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