我正在尝试通过ssh命令从jq
命令的输出创建一个文件。
ssh <server-Name> "jq '.credsStore = "ecr-login"' ~/.docker/config.json > ~/.docker/output.json "
它给了我以下错误:
bash: .docker/output.json: No such file or directory
我没有正确运行命令还是有其他问题?
答案 0 :(得分:0)
ssh "$server" "bash -s" <<'EOF'
[[ -e ~/.docker/config.json ]] || {
echo "ERROR: $HOME/.docker/config.json does not exist on the remote server" >&2
exit 1
}
jq '.credsStore = "ecr-login"' \
<~/.docker/config.json \
>~/.docker/output.json
EOF