0

I have a script that uses curl to send a file to our third party cloud file storage.

I am using grep to pull out a URL provided to me in an http response

looks like this

curl -X PUT -T media/file.tar.gz -D - \
     -H "ETag: ${md5}" \
     -H "Content-Type: application/x-gzip" \
     -H "${AuthToken}" \
     -H "X-Object-Meta-Date: ${today}" \
     "${StorageUrl}/dp/file1.tar.gz"

and then I get a bad request on the url which prints out like

'PUT /v1/MossoCloudFS100213=123-123-1233a-ss9\r/dp/file1.tar.gz'

see that \r that just annoyingly has been injected between my variable and the /dp/?

1
  • 2
    Are you 100% sure that you don't have an extraneous \r in ${StorageUrl} itself? Commented Apr 27, 2012 at 16:28

1 Answer 1

2

I guess that you got the $StorageUrl value from a web request and the web response line ended with CRLF (the web standards generally require CRLF line endings). The shell removed the LF (newline) for you, but not the CR (\r, carriage return). You'll probably need to take care of that yourself before using the URL.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.