My first script (so go easy on me!)

Robert L Hicks bobhicks at adelphia.net
Tue Jan 16 10:50:17 EST 2001


#!/usr/bin/python

##
# This is a small script to cause the inetd daemon to re-read itself
##

r = "kill -HUP `ps cax|grep inetd|awk '{print $1}'`"  # restarts the daemon
n = "Inetd not restarted"
w = "Answer needs to be 'yes' or 'no'. Try again!"

answer = " "
 
query = raw_input("Do you want to restart the INETD daemon? (yes/no): ")

answer = query

if len(answer) > 2:
    print r
elif len(answer) < 2:
    print w
else:
    print n


Is this ok? My question is when the print statement is run do I need to do a
linefeed so the terminal accepts what was printed? Or does the fact that
python send the print to the terminal cause the terminal to execute it?

How would you clean this up?

Bob




More information about the Python-list mailing list