在 cloud init runcmd 中使用管道失败
Using a pipe in cloud init runcmd fails
如何在我的云初始化脚本的 runcmd
部分使用管道重定向命令的输出?以下失败:
runcmd:
- [curl, -sk, https://example.com/packages/current/install.bash, '|', /bin/bash, -s, agent:certname=XYZ.com]
它最终创建了一个如下所示的脚本:
'curl' '-sk' 'https://example.com/packages/current/install.bash' '|' '/bin/bash' '-s' 'agent:certname=XYZ.com'
由于管道被引用,脚本失败。我怎样才能解决这个问题?
不要使用数组,而是使用单个字符串。
runcmd:
- 'curl -sk "https://example.com/packages/current/install.bash" | /bin/bash -s, agent:certname=XYZ.com'
另请参阅:https://www.digitalocean.com/community/questions/help-with-cloud-init-syntax-for-runcmd
如何在我的云初始化脚本的 runcmd
部分使用管道重定向命令的输出?以下失败:
runcmd:
- [curl, -sk, https://example.com/packages/current/install.bash, '|', /bin/bash, -s, agent:certname=XYZ.com]
它最终创建了一个如下所示的脚本:
'curl' '-sk' 'https://example.com/packages/current/install.bash' '|' '/bin/bash' '-s' 'agent:certname=XYZ.com'
由于管道被引用,脚本失败。我怎样才能解决这个问题?
不要使用数组,而是使用单个字符串。
runcmd:
- 'curl -sk "https://example.com/packages/current/install.bash" | /bin/bash -s, agent:certname=XYZ.com'
另请参阅:https://www.digitalocean.com/community/questions/help-with-cloud-init-syntax-for-runcmd