【问题标题】:How to declare an option which doesn't allow any argument using getopts如何使用 getopts 声明一个不允许任何参数的选项
【发布时间】:2018-10-18 13:01:21
【问题描述】:

我正在尝试了解如何使用 getopts 为 ksh 脚本配置选项,我在 declaring options using getopts 上找到了以下详细信息:

Use : for options that require arguments.
Use # for options that require numeric arguments.
Use :? and #? for options that allow arguments but don't require them.

但是是否可以声明一个不允许任何参数的选项并添加有关该选项的文本描述?

【问题讨论】:

    标签: shell unix ksh getopts


    【解决方案1】:

    不同的 getopt() 方法不同。有针对不同语言的,甚至……是哪一种?

    阅读精美的文档!我相信你会在那里找到各种各样的例子,而且作为奖励,比在这里提问和等待答案要快。

    【讨论】:

      猜你喜欢
      • 2014-01-24
      • 2013-04-17
      • 1970-01-01
      • 2015-06-29
      • 2016-04-01
      • 2020-05-10
      • 2020-01-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多