This is my first post on SO, so please tell me if I am doing something wrong.
I am interested in using different programming languages in ipython, similar to babel/l
One option, though limited, allows the stdout and stderr variables to be set. This gives you the availability of setting and passing two variables in between cells. For example:
In [1]:%%bash --out var1 --err var2
echo "Hello"
echo "Hi" >&2
In [2]:print(var1)
print(var2)
# Resulting in:
Hello
Hi
In [3]:%%bash -s "$var1" "$var2"
echo "arg1 takes on var1 = $1"
echo "arg2 takes on var2 = $2"
# Resulting in:
arg1 takes on var1 = Hello
arg2 takes on var2 = Hi
Note that the eol character seems to make its way into the variable.
For details on using stdout and stderr see http://nbviewer.ipython.org/github/ipython/ipython/blob/master/examples/IPython%20Kernel/Script%20Magics.ipynb
For details on passing variables back in see Can I access python variables within a `%%bash` or `%%script` ipython notebook cell?