Carriage Returns

I ran into a puzzling and then infuriating problem.

I was writing a shell script. In the script I wanted to parse text strings into variables and concatenate those variables into one string. The results never were as expected. Some of the variable data was always missing from the final string.

After much weeping and gnashing of teeth and wasted time, a flicker of the proverbial light bulb occurred in my mind. I remembered having seeing this quirk.

I looked closely at the final string output. I noticed fragments of missing variables in the final concatenated string.

Yes indeed.

The data contained damnable carriage returns (^M).

My concatenation was working. The carriage returns were overwriting characters in the final string. Some of the data contained the carriage returns and some did not.

Fool me once shame on you. Fool me twice shame on me.

Posted: Category: Usability Tagged: General

Next: Java Plugin

Previous: Disabling Thunderbird Email Accounts