I am trying to call a bash function and assign the output the function returns to a variable. However, when I run the code below, I get the following error and I don't understand what I may be doing wrong:
test.sh: return: line 7: Illegal number: aGVsbG93b3JsZA==
helloworld
convertfrombase64 () {
B64DATA=$1
echo "$B64DATA" | base64 -d
return "$B64DATA"
}
PLAINTEXT=$(convertfrombase64 "aGVsbG93b3JsZA==")
echo "$PLAINTEXT"