示例代码如下,求帮助
```go
package main
import (
"fmt"
"os/exec"
"strings"
)
func main() {
c := exec.Command("ssh", "myuser@192.168.8.82", "ls", "-l")
c.Stdin = strings.NewReader("mypassword\n")
output, err := c.CombinedOutput()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(output))
}
```
有疑问加站长微信联系(非本文作者)