shell access

Tim Chase python.list at tim.thechases.com
Mon Jan 11 17:42:39 EST 2010


monkeys paw wrote:
> How do you access the command line from the
> python interpreter?
> 
> on unix:
> 
> type python
> 
>  >>> print 'hey'
> 'hey'
>  >>>   # I want to access the shell here, how do i do that?

If you're interactive, I'd just use standard process/job control, 
and hit control+Z to suspend and "fg" to resume:

   tim at rubbish:~$ python
   Python 2.5.4 (r254:67916, Nov 19 2009, 19:46:21)
   [GCC 4.3.4] on linux2
   Type "help", "copyright", "credits" or "license" for more 
information.
   >>> print 'hello'
   hello
   >>> # (hitting ^Z here instead of typing this command)
   [1]+  Stopped                 python
   tim at rubbish:~$ ls tmp/[xyz]*.py
   tmp/x.py  tmp/xyz.py
   tim at rubbish:~$ fg
   python
   print 'world'
   print 'world'
   world
   >>>


-tkc







More information about the Python-list mailing list