title: How do I know a program exited, from serial console perspective
body: <p>I have a program that communicates via serial port to the target. The target is likely a shell or similar program. In case I want to send several commands to the target, how can I know a command is end so that I can send the next command?</p>
  
  <p>I have had some ideas, like catch the shell prompt or let the command output some text before exits. But these will increase the complexity. I'd like to know if there are some other simpler method to achieve it.</p>