roughly complete shell.py