Insomnia

Echoing text, with line-feeds, in Cygwin bash

The Subversion administrator, at my workplace, has a commit flag that forces commits to include messages with a specific format.

Issue ID XXXXX – Summary
Reviewed By: John Doe
Reviewed On: MM/DD/YYYY
Text of commit message.

Since most of the developers use TortoiseSVN, they can type those values into Tortoise at at each commit. I also believe there might be some custom fields in Tortoise, that help format the message.

Cygwin bash (and any bash, I believe) will ignore line feeds that are wrapped in quotes. So using, % svn commit -m “This is \n a new line”, doesn’t work.

The solution I found was to use the -e flag in echo and echo the output in the commit message parameter.

For example,

% svn commit -m "`echo -e “TTP 21483 – JUnit changes\nReviewed By: John Doe\nReviewed On: 10/25/2011\nAdding tests for FooBar”`"