So IPython now has a back end called Jupyter that supports a large number of kernels as well as Python.
This means we can write Jupyter notebooks with
bash for example.
Installing Python 3
The bash kernel requires Python 3 and I’ve only installed Anaconda using Python 2.7. How do we easily get Python 3.4 or later as the kernel requires?
Fortunately conda can create a Python environment with Python 3 in one easy step.
conda create -n py3k python=3 ipython notebook
That creates the environment using Python 3 and adds the IPython and Juypter system with notebook support.
This will give us all we need so then
source activate py3k will turn it on.
You can tell you are in a conda environment as the bash prompt is prepended with the name of the environment like so
Getting the kernel
The new bash kernel can be installed with pip and a self installer –
pip install bash_kernel ; python -m bash_kernel.install
Now go to the directory containing your notebooks and
jupyter notebook will get it running.
In diagram 1 you can see that we are in a
bash notebook as indicated at top right. You can see a bash comman line being run at the bottom.
We create a new bash notebook just by selecting
New Notebook under the file menu and the sub-item allows you to choose the notebook type as in diagram 2.
The bash notebook works just like a Python one. Enter some code into a cell and press Ctrl-Return to run the code. Have fun.