Docable notebooks supports Terminal cells, (Repl and Shells) for advanced usage including custom REPL cells and shells.
Run a command to write "Hello World!" in /tmp/hello.txt:
echo "Hello World!" > /tmp/hello.txt
Type cat /tmp/hello.txt in terminal below to check the result of command cell above:
Creating a Terminal cell is easy, simply set the cell type to terminal
```|{type:'terminal'}
```
This will create a terminal shell for your platform's default shell (powershell on win32, otherwise bash).
The content of the terminal cell will automatically run when the terminal loads. For example the terminal created as below, will start a bash session and run ls -al command as soon as it loads.
```|{type:'terminal', command: 'bash'}
ls -al
```
You can also specify your desired shell (zsh, etc) or REPL when creating the terminal cells. This can be done in two ways.
-
Using the
commandproperty (set tozsh,python,node,redis,mysqletc as long as supported in your environment)```|{type:'terminal', command: 'node'} ``` -
By setting the cell's "language"
```node|{type:'terminal'} ```
If both command property and language are set, command will take precedence. For instance, the cell below will show a node REPL not python.
```python|{type:'terminal', command: 'node'}
```
Here is a node REPL as example:
let a = 1;
a
a + 3
Here is a python REPL:
Here is a Ruby REPL (irb):
And here is a Java REPL (JShell):