Whenever I use curl to get a file like .profile from Pastebin, the .profile file isn't read properly. I did some checking, and it seems to be down to the carriage returns.
How do I solve this problem? Can I correct the carriage returns in transit?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
For reasons that pass understanding pastebin.com raw mode uses Windows line endings - carriage return followed by linefeed - rather than plain linefeed that is used by all right thinking operating systems.
So you need to remove the carriage returns. The easiest way to do this is using
curl https://pastebin.com/raw/qg0r3wt | tr -d '\r' > .profile
That will save the contents of the pastebin
qg0r3wt into the file
.profile with carriage returns removed.