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!

有帮助吗?

解决方案

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top