bash sudo redirect multiple lines to file

sudo cat << EOF | sudo tee -a /etc/docker/daemon.json 
{
    "registry-mirrors" : [
        "http://registry.docker-cn.com",
        "http://docker.mirrors.ustc.edu.cn",
        "http://hub-mirror.c.163.com"
    ],
    "insecure-registries" : [
        "registry.docker-cn.com",
        "docker.mirrors.ustc.edu.cn"
    ],
    "debug" : true,
    "experimental" : true
}
EOF
sudo bash -c 'cat << EOF > /etc/docker/daemon.json
{
    "registry-mirrors" : [
        "http://registry.docker-cn.com",
        "http://docker.mirrors.ustc.edu.cn",
        "http://hub-mirror.c.163.com"
    ],
    "insecure-registries" : [
        "registry.docker-cn.com",
        "docker.mirrors.ustc.edu.cn"
    ],
    "debug" : true,
    "experimental" : true
}
EOF'
posted @ 2021-02-24 11:19  fndefbwefsowpvqfx  阅读(83)  评论(0编辑  收藏  举报