Golang automate input for interactive bash command

Hi everyone,

I’m trying to do a small golang wrapper for an interactive bash command. The purpose of it is that it can automate some of the input based on the output that I receive from the bash command.

My golang program needs to run a cmd, read it output and whenever the cmd is asking for some input, based on the last output it produced: it will determine weither I want to send an automated input or manually enter the input like if I was running the command directly without the golang wrapper.

I’m a beginner in golang, I think that this should be an easy script to do but I cannot find any ways to do it properly. I believe I need go routines for that but so far no success.

Could someone explain me the way he would create this wrapper, or even send me a small and easy code that works and do the job.

Thank you for any of the help you can provide!

you can try this library directly:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.