Are there standards for Linux command line switches and arguments?

前端 未结 4 1518
孤独总比滥情好
孤独总比滥情好 2020-12-02 07:40

This is more about the invocation of a program, than any language or parser (though I\'m sure choice of parser library can depend on this). See, I\'ve used a lot of Linux co

4条回答
  •  一整个雨季
    2020-12-02 08:02

    ESR has collected a lot of information about this in his book "The Art of UNIX Programming". Here's a snippet.

    -a
    All (without argument). If there is a GNU-style --all option, for -a to be anything but a synonym for it would be quite surprising. Examples: fuser(1), fetchmail(1).

    Append, as in tar(1). This is often paired with -d for delete.

    -b
    Buffer or block size (with argument). Set a critical buffer size, or (in a program having to do with archiving or managing storage media) set a block size. Examples: du(1), df(1), tar(1).

    Batch. If the program is naturally interactive, -b may be used to suppress prompts or set other options appropriate to accepting input from a file rather than a human operator. Example: flex(1).

    -c
    Command (with argument). If the program is an interpreter that normally takes commands from standard input, it is expected that the option of a -c argument will be passed to it as a single line of input. This convention is particularly strong for shells and shell-like interpreters. Examples: sh(1), ash(1), bsh(1), ksh(1), python(1). Compare -e below.

    Check (without argument). Check the correctness of the file argument(s) to the command, but don't actually perform normal processing. Frequently used as a syntax-check option by programs that do interpretation of command files. Examples: getty(1), perl(1).

    See the full list at http://catb.org/~esr/writings/taoup/html/ch10s05.html

提交回复
热议问题