[Tutor] issuing system commands

Dan Klose perlmunky at googlemail.com
Fri Jan 26 13:01:22 CET 2007

Hi All,

I am trying to break my nasty habit of doing EVERYTHING in perl and for this
task I figure python is one of the better options.

I would like to do several things:

1. take user input - this will be a password
2. use some sort of function that converts the unser input to * or the
typical '' no output of linux.
3. Take this input and use it in the os.system to issue an su command.

All I have so far is:

import os, sys
password = raw_input('Enter USER password: ')
print "you entered ", password
os.system("su perlmunky password")

I guess point three is more of a system dependent problem - As I work on a
mac and linux is there a better way of issuing these commands?  All I really
want to do is mount/unmount directories and shift / delete files.  I know
how to do this in perl, but as I said I really want to kick the habit.

Any help - pointers - advice would be most welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070126/8c158557/attachment.htm 

More information about the Tutor mailing list