ReadLine

ReadLine[stream]
reads a line of text from a stream and returns it as a string.

ReadLine[proc]
reads a line of text generated by an external process and returns it as a string.

Details and OptionsDetails and Options

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Start the system shell process:

In[1]:=
Click for copyable input
Out[1]=

Read all initial output; depending on the operating system and shell, this can result in an empty string:

In[2]:=
Click for copyable input

Write a command into the shell:

In[3]:=
Click for copyable input

Read the command output:

In[4]:=
Click for copyable input
Out[4]=

Start the system shell process:

In[1]:=
Click for copyable input
Out[1]=

Read all initial output; depending on the operating system and shell, this can result in an empty string:

In[2]:=
Click for copyable input

Write two "echo" commands in the shell, then close it with "exit":

In[3]:=
Click for copyable input

Read the shell process output:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=
Introduced in 2014
(10.0)