This is my first post on SO, so please let me know if the problem is not well defined. I have a script process.ipy in which I am trying to implement a cell magic as follows,
#!/usr/bin/env ipython
%%bash
ls
When I run this on the command line (Ubuntu and zsh shell), I get the following error,
$ ipython process.ipy
File "<ipython-input-1-f108be8d32f2>", line 3
%%bash
^
SyntaxError: invalid syntax
However, I can run this in the ipython session without a problem,
In [1]: %%bash
...: ls
...:
process.ipy
More confusing, is that the single line version works in the script,
#!/usr/bin/env ipython
!ls
What am I doing wrong? Is something not setup correctly?