Thursday, July 19, 2012

Subversion and Shell Script : ^M character

The next assignment was to put all shell scripts, perl scripts and data files under source control and obviously subversion was my choice as we are using the same for source control of application code base.

Everything went smooth initially but we ran into issues while executing shell scripts post svn update on UNIX box. It was quite clear that EOL character introduced while editing our files in Windows development environment converts into the infamous ^M character.

Removing these characters using dos2unix or stripping the character via VI editor using find and replace were not functional solutions in the long run; so I started searching again for something which might be of help in this case and eventually got to the Solution

The subversion properties are a neat solution to such issues; just set the repository property svn:eol-style as native and let subversion maintain the EOF characters by itself.

The newlines of Windows will never be ^M of UNIX.

No comments:

Post a Comment