Skip to content

Instantly share code, notes, and snippets.

@msabramo
Created October 14, 2011 00:35
Show Gist options
  • Select an option

  • Save msabramo/1285923 to your computer and use it in GitHub Desktop.

Select an option

Save msabramo/1285923 to your computer and use it in GitHub Desktop.
pathmanager.py
#!/usr/bin/env python
# Meant to be used with a bash function like:
# ppp() { eval $(./pathmanager.py "$@" ); }
import os, sys
if len(sys.argv) == 1 or sys.argv[1] == 'list':
print('echo $PATH | tr ":" "\\n"')
sys.exit(0)
if sys.argv[1] == 'append':
print('export PATH=${PATH}:%s' % sys.argv[2])
if sys.argv[1] == 'prepend':
print('export PATH=%s:${PATH}' % sys.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment