We’ve used expect for automatically testing a router CLI over telnet back in the days. I remember that experience as outright painful. So many, ahem, unexpected things can break the process.
It may be somewhat better for purely local applications of course.
A great use I found for this is a script that lets me scp files to an embedded machine without typing the password each time.
I’m glad that your workflow works for you, and I know there may be constraints that I’m not aware of, but I feel like I should mention ssh-agent as another way to solve this problem, just in case.
The ssh fingerprint changes with every boot on the device, as we don’t persist much right now. It’s on the list of things to fix one day. :)
Without wanting to invalidate your use case: This sounds like the machine is in development. Wouldn’t it be possible to have an authorized key baked into the filesystem from which it boots (which the build system only does on development/testing builds of the image)?
It is! It is a bit of a process and I don’t work directly with the hardware side of things, so the expect script is a hack. :)
You can’t use public key authentication?