I am trying to get a base64 encode to work and output to a variable in a bash script. The regular cli syntax is:
echo -ne "\[email protected]\0mypass" | base64
But when I try putting this into a variable in a script it outputs, but a very small encoding, so I know it's not working. My code in the script is:
auth=$(echo -ne "\0$user@$host\0$pass" | base64);
I know it has something to do with the quotes, but I've tried a myriad of thing's with different quotes and singles and backslashes with no go.
Any thoughts?
EDIT: A bit more for the info. This should output with the user/pass/host above:
AG15dXNlckBteWhvc3QuY29tAG15cGFzcw==
But in the script it outputs:
LW5lIAo=
$user,$hostand$passare set? Sorry for a stupid question, but gotta rule out the obvious stuff. Cause in my test it works allright, see pastebin.com/mSR64eEh