This question about Missing functionality: Answered

how to insert newline when running save from command line

I would like to call the save command from a bash script with something like this:

twiki/bin/save -topic Sandbox.TestTopic1 -user ChrisPurves -text "$text_variable"

How can I get newlines into the -text parameter?

Doesn't $n do the trick?


Very interesting. I googled, tested and found a way, maybe not suitable, but it worked. Filename contains the text. Remember to have blank lines or they seem to be put on the same line.
-text "`cat filename`" 
It also works to read the file into a variable (eg. TXT=`cat file`) and then use
-text "$TXT" 
You can make multiline variables in BASH also by:

echo "$VAR" 

-- LarsEik - 26 May 2009

Thank you, Lars. I used your sugguestion of -text "`cat filename`" , and once I had blank spaces between the lines it worked perfectly. I think the part I was missing previously was not having blank spaces between the lines. Thanks again for your help.

-- ChrisPurves - 26 May 2009

Most shells have the concept of a "here document". For example,
-text <<HERE

This pulls everything between HERE and HERE into a single parameter. See the documentation of your favourite shell for more information.

-- CrawfordCurrie - 27 May 2009

QuestionForm edit

Subject Missing functionality
Version TWikiRelease04x02x03
Status Answered
Topic revision: r5 - 27 May 2009, CrawfordCurrie - This page was cached on 05 Aug 2020 - 13:15.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy