# Print without newline in command line mode

Does Mathematica provide any way to print text to the terminal without a newline at the end when running in command line mode? There are many workarounds with the notebook interface, but this question is specifically about the command line.

I would like to use this for more detailed progress monitoring on a headless machine. The only solution I could think of so far is using LibraryLink to do the printing, which isn't that bad actually as I do already have a LibraryLink component in this program.

To sum up, I want a print function so that

Do[Pause[1]; print["."], {5}]


produces

.....


in a terminal session and the dots appear gradually.

It seems my question was premature. This can be done by writing to stdout using WriteString.

Notice that stdout is open as a stream:

In[13]:= Streams[]
Out[13]= {OutputStream[stdout, 1], OutputStream[stderr, 2]}


We can simply use

Do[WriteString[OutputStream["stdout",1] ,"."], {5}]


This works on OS X and Linux. I haven't tried on Windows.

• Works on Windows too. – user31159 Sep 15 '16 at 12:16