"Generate Shell Commands in Go"의 두 판 사이의 차이

 
23번째 줄: 23번째 줄:
==같이 보기==
==같이 보기==
* [[Go exec()]]
* [[Go exec()]]
* [[Go shellescape]]
* [[Go quote()]]


==참고==
==참고==

2022년 6월 2일 (목) 04:20 기준 최신판

1 개요[ | ]

Generate Shell Commands in Go
package main

import (
	"fmt"

	"github.com/keegancsmith/shell"
)

func main() {
	fmt.Println(shell.Sprintf("echo hello %S", []string{"foo.go", "bar.go", "| rm -rf /"}))
	fmt.Println(shell.Sprintf("echo hello %S", []string{"foo.go", "bar.go", "; rm -rf /"}))
	fmt.Println(shell.Sprintf("echo hello %S", []string{"foo.go", "bar.go", "'| rm -rf /"}))
	fmt.Println(shell.Sprintf("echo hello %S", []string{"foo.go", "bar.go", "'; rm -rf /"}))
	fmt.Println(shell.Sprintf("echo hello %S", []string{"foo.go", "bar.go", "'| rm -rf /'"}))
	fmt.Println(shell.Sprintf("echo hello %S", []string{"foo.go", "bar.go", "'; rm -rf /'"}))
}

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}