Skip to content

Instantly share code, notes, and snippets.

@soulwire
Created October 21, 2011 10:16
Show Gist options
  • Save soulwire/1303507 to your computer and use it in GitHub Desktop.
Save soulwire/1303507 to your computer and use it in GitHub Desktop.
Can I access the bash shell that's executing a Python script from within the script?
# myscript.py
import subprocess
subprocess.call(['alias', 'my_ls=ls'])
# In the bash shell
$ python myscript.py
# Can I use the my_ls alias here?
$ my_ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment