sudo cat << EOF> File doesn't work, sudo su does

前端 未结 5 1683
南笙
南笙 2020-12-23 09:23

I tried the following on the command prompt in bash:

sudo cat << EOF > /etc/yum.repos.d/some-name.repo
#Content
#....
#...
EOF

It

5条回答
  •  自闭症患者
    2020-12-23 09:55

    if you are using ' inside the text then you may use:

    $ sudo bash -c "cat > /etc/postfix/mysql-virtual_forwardings.cf << EOF
    user = mail_admin
    password = password
    dbname = mail
    query = SELECT destination FROM forwardings WHERE source='%s'
    hosts = 127.0.0.1
    EOF
    "
    

    this is tested on google cloud's virtual server centos 7.0

提交回复
热议问题