我有命令
docker container exec -it man docker service ps $1 --no-trunc --filter "desired-state=running" --format "docker container exec -it {{.Node}} docker container exec -it {{.Name}}.{{.ID}} bash"
它在 stdout 中返回如下字符串
docker container exec -it 13247a1833e9 docker container exec -it django_python.yhb1osnt1wn32hbkixhf50r38.hzsgyxbdkpitrsa6fdjiyi4qu bash
现在我想执行这个。
我的脚本在这里,
msg=`docker container exec -it man docker service ps $1 --no-trunc --filter "desired-state=running" --format "docker container exec -it {{.Node}} docker container exec -it {{.Name}}.{{.ID}} bash"`
eval ${msg}
但它返回错误
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"bash\\r\": executable file not found in $PATH": unknown
我该如何解决这个问题?