What is the general syntax of a Unix shell command?

后端 未结 4 1848
说谎
说谎 2020-11-29 07:01

In particular, why is that sometimes the options to some commands are preceded by a + sign and sometimes by a - sign?

for example:

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-29 07:26

    It's left to apps to parse options hence the inconsistency. Expanding on your sort example these are all equivalent for coreutils:

    sort -k3
    sort --k 3
    sort --key 3
    sort --key=3
    _POSIX2_VERSION=199209 sort +2
    

提交回复
热议问题