#!/usr/bin/expect set timeout 20 set prompt "] " spawn ./nanokdp -d /dev/cu.usbserial-MCU2 expect "*MCU2" send "help\r" expect -re $prompt interact