[IPython-user] ipython to replace bash scripts?

Florian Lindner mailinglists@xgm...
Wed Dec 9 11:09:18 CST 2009


I have some small bash scripts that I want to replace with python scripts.

- Is ipython -p sh the right interpreter to start? My first try to do 
something bash like was:

#!/usr/bin/ipython -p sh

a = !ls

(called from bash) but it resulted in:

ImportError: Import by filename is not supported.

and I got thrown into the ipython shell.

- Or should I use normal python for these kind of scripts?

Things I would miss from bash is the seamless calling of external programs, 
connecting them with pipes and working with their output. I know that I can do 
all this stuff with python but it is not so well integrated. Therefore I hope 
that ipython could provide something to work this way? I have already seen 
things like !ls for getting the output and the SLists. What is right way to 
use them non-interactively?



More information about the IPython-user mailing list