I found this fairly amusing, but just a big if statement? So I ported it to Python. I was reminded that iterating over stdin in Python is always a bit weird. I generally create an iterator that just yields sys.stdin.readline() forever, but went more hackish here to conserve lines and add lulz.
import sys
print "You have no mail"
commands = {
"uname": lambda args: "Punix 1.0",
"halt": lambda args: exit(0)
}
error = lambda args: "Command not found."
sys.stdout.write("$ ")
for line in (sys.stdin.readline() for i in xrange(sys.maxint)):
print commands.get(line.split()[0], error)(line.split()[1:])
sys.stdout.write("$ ")