goを使用してコマンドを実行しようとしています。Golang:引数を指定してコマンドを実行する
executableCommand := strings.Split("git commit -m 'hello world'", " ")
executeCommand(executableCommand[0], executableCommand[1:]...)
cmd := exec.Command(command, args...)
しかし、ここで私は、コマンドラインが" "
を使用して分割されているので-m
は'hello
だけではなく'hello world'
を取得するためです
error: pathspec 'world"' did not match any file(s) known to git.
exit status 1
を得るものです。
それを動作させるにはどんな考えですか?