Bash 使用“运行shell命令”;重定向子shell的输出;围棋中的声明

Bash 使用“运行shell命令”;重定向子shell的输出;围棋中的声明,bash,go,command-line,Bash,Go,Command Line,根据,如何运行命令: bash --rcfile <(echo "export PS1='> ' && ls") 我也读过这篇文章,但我认为我的情况可能有点复杂。你差不多做到了-我认为混淆之处在于你在使用管道调用bash,这意味着你实际上需要使用bash调用bash: exec.Command(“bash”、“-c”、`bash--rcfile exec.Command("bash", "--rcfile", `<("echo 'ls'")`) exec.C

根据,如何运行命令:

bash --rcfile <(echo "export PS1='> ' && ls")

我也读过这篇文章,但我认为我的情况可能有点复杂。

你差不多做到了-我认为混淆之处在于你在使用管道调用bash,这意味着你实际上需要使用bash调用bash:

exec.Command(“bash”、“-c”、`bash--rcfile
exec.Command("bash", "--rcfile", `<("echo 'ls'")`)
exec.Command("bash", "-c", `bash --rcfile <(echo "export PS1='> ' && ls")`)