sed 命令不适用于 AWS 模板
sed command not working on AWS template
我有一个 sed 命令,我想 运行 一个文件。该命令在字符串前面添加几行。
这是我想要的sed命令运行:
sed -i "/<\/VirtualHost>/i\ SSLCertificateFile /etc/httpd/cert/aws.cer \nSSLCertificateKeyFile /etc/httpd/cert/aws.key" ssl.conf
云形成模板用户日期中的 JSON 条目是:
"sed -i '/<\/VirtualHost>/i \ \nSSLCertificateFile /etc/httpd/cert/aws.cer \nSSLCertificateKeyFile /etc/httpd/cert/aws.key' /etc/httpd/conf.d/ssl.conf \n",
但我收到以下错误:
sed: -e expression #1, char 23: unknown command: `S'
有人可以帮我修正 JSON 表达式吗?
换行前反斜杠后面的空格似乎不对;为什么它们在那里,如果你删除它们会有帮助吗? '/<\/VirtualHost>/i \ \n... – 三人 10 月 1 日 3:45
感谢 tripleee 的回答
我有一个 sed 命令,我想 运行 一个文件。该命令在字符串前面添加几行。
这是我想要的sed命令运行:
sed -i "/<\/VirtualHost>/i\ SSLCertificateFile /etc/httpd/cert/aws.cer \nSSLCertificateKeyFile /etc/httpd/cert/aws.key" ssl.conf
云形成模板用户日期中的 JSON 条目是:
"sed -i '/<\/VirtualHost>/i \ \nSSLCertificateFile /etc/httpd/cert/aws.cer \nSSLCertificateKeyFile /etc/httpd/cert/aws.key' /etc/httpd/conf.d/ssl.conf \n",
但我收到以下错误:
sed: -e expression #1, char 23: unknown command: `S'
有人可以帮我修正 JSON 表达式吗?
换行前反斜杠后面的空格似乎不对;为什么它们在那里,如果你删除它们会有帮助吗? '/<\/VirtualHost>/i \ \n... – 三人 10 月 1 日 3:45
感谢 tripleee 的回答