0

Is there a way to use a heredoc as the message via the svn command?

I tried this:

$ echo <<TEXT | svn commit -m - 
  > line one input
  > line two input
  >TEXT

In my repository it just writes the dash as the message.

I tried searching around and didn't find a way of doing a multi-line input other than writing in the \n characters, but it would be great if I could just regular multi-lined text that I've already typed up as the input.

Is it possible using a different method or is it just wishful thinking?

Thanks!

Chris Schmitz
  • 20,160
  • 30
  • 81
  • 137

2 Answers2

1

You can set an environment variable which will allow svn to open up your desired text editor to enter your commit message.

SVN_EDITOR

Look here for more info

Jon Taylor
  • 7,865
  • 5
  • 30
  • 55
1

If you really want to use a here document you need to use the -F option. But your other problem is you're using echo which doesn't take any input on stdin. You want cat.

So the following will work:

cat <<TEXT | svn commit -F -

If you're doing this interactively I think you'll prefer Jon Taylor's answer.

Ben Reser
  • 5,695
  • 1
  • 21
  • 29