Hi I'm looking to take a user input and use it to effect just two characters in a command rather than having multiple functions for each one.
function baseencode() {
echo "This function handles the following: $YELLOW base64 base32 base16 $NORMAL"
echo "$GREEN Select 64 32 or 16 $NORMAL"
read B
echo "Enter text to be encrypted"
read baseplain
sleep 1
read baseencoded <<< $(python -c "import base64; print base64.b**encode('''$baseplain''')")
echo "$RED Converted string: $baseencoded $NORMAL"
I want to make so the two asterisks become whatever the user inputs.
Try changing base64.b**encode
to base64.b${B}encode
.
Perfect, cheers dude.
Solved.