Created
May 30, 2018 15:31
-
-
Save hichihara/2d18510d638b0268b6b4ffc0cefd9c0f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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