Skip to content

Instantly share code, notes, and snippets.

@billy3321
Created February 27, 2009 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billy3321/71351 to your computer and use it in GitHub Desktop.
Save billy3321/71351 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import commands
import re
user_homedir=commands.getoutput('cat /etc/passwd | grep %s | cut -d ":" -f 6' % (user_name)).split('\n')
ims_cmd = "export INPUT_METHOD=\"%s\"" % (selected_cin)
user_profile = open(str(user_homedir[0])+'/.profile', 'rw')
profile_contain = user_profile.readlines()
profile_len = len(profile_contain)
search_str = re.compile('^export INPUT_METHOD=')
for i in range(profile_len):
if search_str.match(profile_contain[i]):
del profile_contain[i]
user_profile.write()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment