I use a CLI that starts a prompt in my shell. However, I usually end up typing the same commands at the prompt. Is there a way to manually automate the starting of the CLI and then send input in one go?
Here is an example: I type spotify to start my music client.
I see:
Type help to see commands.
> list
These are your playlists
1. ...
2. ...
(some lines omitted) where “>” is a prompt I am typing at. I want my script to type list for me then play and then quit and then start a script which plays my iTunes library. How could I go about doing this?
Expect is what I was looking for. It’s a UNIX testing and automation tool for exactly this purpose.