Skip to content

WriteString

Write a string to an output stream.

The stream can be named directly, or given as the OutputStream[…] expression that $StandardOutputStream stands for. Both write to the process's standard output, and neither appends a newline of its own.

$ wo 'WriteString["stdout", "hello world\n"]'
hello world
Null
$ wo 'WriteString[$StandardOutputStream, "hello world\n"]'
hello world
Null

$StandardErrorStream writes to standard error instead:

$ wo 'WriteString[$StandardErrorStream, "oh no\n"]' 2> /dev/null
Null

All arguments after the stream are written in one go, without separators:

$ wo 'WriteString[$StandardOutputStream, "a", "b", "c\n"]'
abc
Null