Arguments with exec.Command

Hi all,

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.



1 Like

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.


Thx Nobbz,

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\r\n")


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