/bin/bash -c 的作用

k8s的很多yaml的配置文件中,很多地方执行bash命令时 要加上 -c 。

bash手册中对其解释

-c string If the -c option is present, then commands are read from string.  If there are arguments after the string, they are assigned to the positional parameters, starting with $0.

/bin/bash 后面默认执行的时脚本文件 。

加上 -c 之后会将字符串读入作为执行的命令。

posted @ 2023-05-07 21:26  zed99  阅读(436)  评论(0编辑  收藏  举报