shell 下使用CURL时 对参数进行urlencode处理

不对内容做 urlencode 会导致传参丢失
url = "https://www.baidu.com"
txt = "aaaa&bbbb"
//urlencode
txtEnCode=`echo -n "$txt" | xxd -ps | tr -d '\n' | sed -r 's/(..)/%\1/g'`;
//curl请求
curl -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'  "${url}" --data-binary @- <<CURL_DATA
t=demo&wd=${txtEnCode}
CURL_DATA