Skip to content

Instantly share code, notes, and snippets.

@hichihara
Created May 30, 2018 15:31
Show Gist options
  • Save hichihara/2d18510d638b0268b6b4ffc0cefd9c0f to your computer and use it in GitHub Desktop.
Save hichihara/2d18510d638b0268b6b4ffc0cefd9c0f to your computer and use it in GitHub Desktop.
package main
import (
"os/exec"
"strconv"
"strings"
)
func ssh(port int) {
cmd := exec.Command("ssh", "root@localhost", "-p", strconv.Itoa(port))
in := "touch hoge\ntouch piyo\nlogout\n"
cmd.Stdin = strings.NewReader(in)
err := cmd.Run()
if err != nil {
}
}
func main() {
ssh(32768)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment