title: python os.environ, os.putenv, /usr/bin/env
body: <p>I want to ensure <code>os.system('env')</code> not contain some specific variable <code>myname</code>
  which is export in <code>~/.bashrc</code> as <code>export myname=csj</code></p>
  
  <p>Therefore, I wrote below python code:</p>
  
  <pre><code>import os
  
  def print_all():
      print "os.environ['myname']=%s" % os.environ.get('myname')
      print "os.getenv('myname')=%s" % os.getenv('myname')
      os.system('env | grep myname')
      print
  
  def delete_myname():
      if 'myname' in os.environ: os.environ.pop('myname')
      if os.getenv('myname'): os.unsetenv('myname')
  
  print_all()
  
  os.putenv('myname', 'csj2')
  print "---------------------"
  delete_myname()
  print_all()
  
  os.putenv('myname', 'csj3')
  print "---------------------"
  delete_myname()
  print_all()
  </code></pre>
  
  <p>I think examine both <code>os.environ['myname']</code> and <code>os.getenv('myname')</code> 
  and then delete them if exist, 
  can ensure <code>os.system('env | grep myname')</code> get nothing.</p>
  
  <p>However, the result is:</p>
  
  <pre><code>os.environ['myname']=csj
  os.getenv('myname')=csj
  myname=csj
  
  ---------------------
  os.environ['myname']=None
  os.getenv('myname')=None
  
  ---------------------
  os.environ['myname']=None
  os.getenv('myname')=None
  myname=csj3
  </code></pre>
  
  <p>I don't understand why I still got <code>csj3</code> on <code>os.system('env | grep myname')</code>?</p>