I want to change the current directory using a subprocess.
For example:
import os, sys, subprocess os.environ['a'] = '/home' os.environ['b'] = '/' subprocess.call('cd $a', shell=True) subprocess.call('ls', shell=True) subprocess.call('cd $b', shell=True) subprocess.call('ls', shell=True)
I think this should work as a unix command line
$ export a='/home' $ export b='/' $ cd $a $ ls $ cd $b $ ls
But this does not happen.
How do I do to change the current directory?
Thanks.
python unix subprocess
JonatasTeixeira
source share