try the cmd and readline module to automate command line