Python as a default shell, replacement of bash, sh, cmd ?

Terry Reedy tjreedy at
Sun Feb 19 13:28:38 EST 2012

On 2/19/2012 3:18 AM, SherjilOzair wrote:
> Well, if not modify python itself, I was thinking of making another
> shell, which borrows a lot from python, something like merging bash
> and python. such that I can do `cd ~/Desktop/dev` and `for i in

'cd xxx' cannot work because that is not python syntax. "cd('xxx')" 
could. Right now, one can import os and do shell stuff, but not so 
convinient for interactive use. 'os.chdir' is not so convenient as 'cd'. 
Two possible options, either of which might exist on PyPI:

1. a shell module used as 'from bashshell import *' which would have 
functions closely mimicking, in this example, bash

2. a shell module used as 'from bashshell import bash; bash()' which 
would invoke an sub-interactive mode like help() that would allow 'cd 
xxx' and similar syntax, which still affecting the global environment.
The latter would trade the inconvenience of '()'s for the inconvenience 
of entering and exiting a special submode.

I have not used IPYthon so I have no idea how close it gets to either of 

Terry Jan Reedy

More information about the Python-list mailing list