OpenSSL Basic Encryption Script With Random Password Generation

Example script using OpenSSL AES 256 with Salt and a random generated password.
It’s the little things.

#!/bin/bash
clear
echo "Input String:"
    read input
        pass=$(echo cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 1024 | head -n 1)
        encrypt="$(echo -e $input | openssl aes-256-cbc -pbkdf2 -iter 20000 -salt -a -e -k $pass)"
        decrypt="$(echo -e $encrypt | openssl aes-256-cbc -pbkdf2 -iter 20000 -salt -a -d -k $pass)"
    echo -e "Encrypted String: "$encrypt
    echo -e "Decrypted String: "$decrypt
    echo "Hit Any Key.."
  read anykey
./$(basename $0) && exit

"Twenty years from now you will be more disappointed by the things that you didn’t do than by the ones you did do."
Mark Twain