bash base64 - ghdrako/doc_snipets GitHub Wiki

base64 cert.pem -w 0 > cert.pem.b64
base64 --decode cert.pem.b64 > cert.pem
base64 -d cert.pem.b64 > cert.pem
  • -i, --ignore-garbage when decoding, ignore non-alphabet characters
  • -w, --wrap=COLS wrap encoded lines after COLS character (default 76). Use 0 to disable line wrapping
#!/bin/bash
echo "Enter Some text to encode"
read text
etext=`echo -n $text | base64`
echo "Encoded text is : $etext"