I am trying to get base64 encoding to work and output to a variable in a bash script. The regular cli syntax is:
echo -ne "\ 0myuser@myhost.com \0mypass" | base64
But when I try to put this in a variable in a script, it produces, but a very small encoding, so I know that it does not work. My code in the script:
auth=$(echo -ne "\ 0$user@ $host\0$pass" | base64);
I know this has something to do with quotes, but I tried a lot of things with different quotes, singles and backslashes without any problems.
Any thoughts?
EDIT: A bit more info. This should be output using the user / pass / host parameter above:
AG15dXNlckBteWhvc3QuY29tAG15cGFzcw==
But in the script, it outputs:
LW5lIAo=
source share