Use linefeed or carriage return in Subversion commit message from the command line

8,447

Solution 1

Try this:

svn ci -m $'This is the first line\nThis is the second line'

Solution 2

Just hit enter when you're typing it, instead of the \n. The prompt will turn to ">" and you can continue typing.

This is a shell question, not a Subversion question.

Share:
8,447

Related videos on Youtube

user1615502
Author by

user1615502

Updated on September 17, 2022

Comments

  • user1615502
    user1615502 almost 2 years

    I am using Subversion 1.6.6 on Ubuntu 10.04, running a bash shell. I would like to insert a carriage return, or linefeed, or newline into my commit message so that when reading the log, the comments are formatted appropriately. It works fine when I use the system editor, or specify a file for the commit comment, but what I really want is to be able to do something like the following:

    svn ci -m "This is the first line\nThis is the second line"
    

    and have the comment presented as:

    This is the first line
    This is the second line
    

    My example does not work, it produces output:

    This is the first line\nThis is the second line

    So, is there a way to do this? If so, how?

  • user1615502
    user1615502 about 14 years
    Thanks for the quick response, and sorry for the mis classification. My goal is to put this into a bash script, so if there is any to do this without hitting enter that would help.
  • Shanmugalakshmi
    Shanmugalakshmi about 14 years
    svn ci -m "this is a test --- next line --- > just a test" Figures I'd have newline problems in the comment about a newline problem :). It'll look like that with the ">" on the next line like Andy said. You can do the same thing in a script file (just tested it with bash).
  • user1615502
    user1615502 about 14 years
    actually, the subversion log worked fine with Dennis' solution.
  • user1615502
    user1615502 about 14 years
    Paul - your command di not work for me. Dennis' command did work.
  • Shanmugalakshmi
    Shanmugalakshmi about 14 years
    Interesting, must be because I'm still running 9.10. I'm glad the simpler command worked!
  • Dennis Williamson
    Dennis Williamson about 14 years
    @Paul: This is a shell feature. It should work in Ubuntu 9.10. Are you sure you're trying it with the dollar sign and single quotes? As a test, at the shell prompt, enter echo $'one\ntwo' it should give you the same output as echo -e 'one\ntwo' which should be "one" on one line and "two" on the next. Double quotes would also work for the echo -e version.