加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

bash – shell脚本中的双冒号::

发布时间:2020-12-16 01:09:20 所属栏目:安全 来源:网络整理
导读:什么是双冒号::在 shell脚本中?像这块脚本: function guess_built_binary_path { local hyperkube_path=$(kube::util::find-binary "hyperkube") if [[ -z "${hyperkube_path}" ]]; then return fi echo -n "$(dirname "${hyperkube_path}")"} 我在这里找
什么是双冒号::在 shell脚本中?像这块脚本:
function guess_built_binary_path {
  local hyperkube_path=$(kube::util::find-binary "hyperkube")
  if [[ -z "${hyperkube_path}" ]]; then
    return
  fi
  echo -n "$(dirname "${hyperkube_path}")"
}

我在这里找到了它:

https://github.com/kubernetes/kubernetes/blob/master/hack/local-up-cluster.sh

::只是函数名的命名约定.是编码风格,如 snake_case或 CamelCase

shell样式中函数名的约定通常是:

Lower-case,with underscores to separate words. Separate libraries
with ::. Parentheses are required after the function name. The keyword
function is optional,but must be used consistently throughout a
project.

你可以查看here.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读