I have a command that builds things and then provides an interactive shell through prompt (eg type R to restart, Q to quit, ...).I would like to use that command but stop it once it reaches the prompt part. Is there a way to either pass the Q argument when calling my command, or killing it once it reaches the prompt?
Start command and provide prompt parameter
command line
Given that your script is reading input normally via read, you can provide it input ahead of time with another program like echo or printf via a pipe:echo Q | your-program-hereA more complex example could be:(echo 1; echo thing2; echo yes; echo Q) | your-program-hereAnd even more complex scripting of automatic input can be done with programs like expect. 