openssl version LibreSSL 2.8.3
#!/usr/bin/env bash
echo $1 | openssl aes-256-cbc -a -salt -pass pass:somepassword
decode.sh
#!/usr/bin/env bash
echo $1 | openssl aes-256-cbc -d -a -pass pass:somepassword
make files executable
chmod +x encode.sh decode.sh
encode example
./encode.sh "this is my test string"
# => U2FsdGVkX18fjSHGEzTXU08q+GG2I4xrV+GGtfDLg+T3vxpllUc/IHnRWLgoUl9q
decode example
./decode.sh U2FsdGVkX18fjSHGEzTXU08q+GG2I4xrV+GGtfDLg+T3vxpllUc/IHnRWLgoUl9q
# => this is my test string