Unable to make IPython to read shell variables

I run the command in IPython

cd $cs<TAB>

but it does not allow me to expand the path.

How can you make IPython to read shell variables?

Upvotes: 2

Views: 429

Answers (1)

ChristopheD
ChristopheD

Reputation: 116137

If i understand correctly what you mean by 'shell variables'. If you mean variables set in the shell ('environment variables'): you can read them with os.environ...

import os
cs = os.environ.get('cs')
runstring = "cd %s" (cs)
...

Upvotes: 5

Related Questions