我正在尝试base64编码shell脚本中的图像并将其放入变量:
test="$(printf DSC_0251.JPG | base64)"
echo $test
RFNDXzAyNTEuSlBH
Run Code Online (Sandbox Code Playgroud)
我也尝试过这样的事情:
test=\`echo -ne DSC_0251.JPG | base64\`
Run Code Online (Sandbox Code Playgroud)
但仍然没有成功.
我想做这样的事情:
curl -v -X POST -d '{"image":$IMAGE_BASE64,"location":$LOCATION,"time_created":$TIMECREATED}' -H 'Content-type: text/plain; charset=UTF8' http://192.168.1.1/upload
Run Code Online (Sandbox Code Playgroud)
我发现了这个http://www.zzzxo.com/q/answers-bash-base64-encode-script-not-encoding-right-12290484.html
但仍然没有成功.