Your question suggests that you want to base64 encode the content of a variable:
$ TEXT=test
$ ENCODED=$(echo "$TEXT" | base64)
$ echo "$ENCODED"
dGVzdAo=
Your question suggests that you want to base64 encode the content of a variable:
$ TEXT=test
$ ENCODED=$(echo "$TEXT" | base64)
$ echo "$ENCODED"
dGVzdAo=