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

linux – BASH:’ – ‘和’ – ‘选项之间的区别

发布时间:2020-12-13 19:51:23 所属栏目:Linux 来源:网络整理
导读:我正在通过 Shell( Bash)Scripting的入门读书,并有以下疑问: I came across the ls command The man page of ls lists a few use cases as : ls -a ls --block-size='M' 我的问题 : What is the difference in - and -- ? Why are there 2 nomenclatures u
我正在通过 Shell( Bash)Scripting的入门读书,并有以下疑问:
  • I came across the ls command
  • The man page of ls lists a few use cases as :

    ls -a

    ls --block-size='M'

我的问题 :

  • What is the difference in - and -- ?
  • Why are there 2 nomenclatures used ?
  • What is the motivation behind it ?

解决方法

长格式(–foo)选项是GNU扩展 – 在GNU ls中存在,但在UNIX工具的POSIX标准设置要求中根本不存在,因此其他版本的ls没有义务支持这些选项.在这种情况下,整个单词(foo)是有意义的.这个命名法最近被添加,并且比短格式更具表现力(并且没有名称空间限制).

短格式选项(-al)至少在形式上是标准化的(尽管扩展可以添加新的选项).它们是逐个字符处理的,一次一个字母 – 所以-al意味着-a(显示隐藏文件)和-l(长输出),而不是在这种情况下-al有自己的含义.这是UNIX命令行选项的原始语法,因此不仅支持简洁性,还支持向后兼容性.

(编辑:李大同)

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

    推荐文章
      热点阅读