title: Use python to dynamically create bash aliases
body: <p>I'm attempting to use python to dynamically create bash aliases (like, for example, aliases to log in to a set of servers).  I'd love to be able to do something like this:</p>
  
  <pre><code>from subprocess import call
  SERVERS = [
      ("example", "user@example.com"),
      #more servers in list
  ]    
  
  for server in SERVERS:
      call('alias %s="ssh %s"' % (server[0], server[1]), shell=True)
  </code></pre>
  
  <p>The problem is that subprocess launches the jobs in a separate shell session, so the program runs fine, but does nothing to the shell session I run it from.</p>
  
  <p>The same problem occurs with python's <code>os.system</code> or attempting to print the commands and pipe them to bash (all of these create the aliases, but in a new shell that is promptly destroyed after the program finishes).</p>
  
  <p>Ultimately, the goal of this is to run this script from .bashrc</p>
  
  <p>How does one do this?</p>