Guest User

Untitled

a guest
Oct 18th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import subprocess
  2.  
  3. lines = subprocess.check_output('source ~/.bash_profile; alias',shell=True).split(b'n')
  4. manager = get_ipython().alias_manager
  5. for line in lines:
  6. line = line.decode("utf-8")
  7. split_index = line.find('=')
  8. cmd = line[split_index+1:]
  9. alias = line[:split_index]
  10. cmd = cmd[1:-1]
  11. print ("ALIAS:{}ttCMD:{}".format(alias,cmd))
  12.  
  13. manager.soft_define_alias(alias, cmd)
Add Comment
Please, Sign In to add comment