New to code and trying to learn Go as a first language. Is it possible to use multi-line arguments with exec.Command?
I am trying to send the following command:
FastCli -p 15 -c ' enable config interface et1 description test'
With each item inside the single quote being its own line.
Thanks for any insight that you can offer.
Yes you can. You need to translate your shells quoting and escaping rules into go’s and just prepare and run the command.
As I’m on mobile now, I can’t do so for you. But it’s usually trivial to do so.
I was able to get it to work with the following:
cmd := exec.Command("/usr/bin/FastCli", "-p15", "-c\r\nenable\r\nconfig\r\nip route 126.96.36.199/32 10.255.255.255\r\n")
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.