#!/bin/bash cmdopt=$1 if [ -z $cmdopt ]; then echo "Please specify -e to encrypt or -d to decrypt" fi if [[ $cmdopt == "-e" ]]; then echo "#---------------------------------------------------" echo "# You'll be asked for your encryption key" echo "# After you enter that key twice:" echo "# Type the text you'd like to encrypt" echo "# and hit ctrl-d when done." echo "# Then you'll get the codegroup encoded form" echo "# of your encrypted data." echo "# Which you can write down wherever." echo "#---------------------------------------------------" ccrypt |codegroup fi if [[ $cmdopt == "-d" ]]; then echo "#---------------------------------------------------" echo "# Type in the codegroup enccoded data to decrypt" echo "# and hit ctrl-d when done." echo "# Then you'll be asked for your encryption key." echo "# After that, you'll get the ccrypt decrypted" echo "# version of your encrypted data." echo "#---------------------------------------------------" todecrypt=$(cat) echo "$todecrypt" |codegroup -d |ccrypt -d fi