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?
command linemacos
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?
Best Answer
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
tr
.That will save the contents of the pastebin
qg0r3wt
into the file.profile
with carriage returns removed.