What is the meaning of the format of command line arguments

I am very curious about why some parameters on the command line are preceded by a "-", some parameters have two "-", and some do not. I want to know what this means? Is it an established norm?

for example

git init
git-- version
ls-a

wait.

Jun.23,2021

For more information, please see posix parameter syntax

.

git uses the posix parameter style syntax.

of course, parameter style is not only posix, but also java style (regardless of short and long parameters, a single - represents option, such as java-jar , java-cd , java-D , etc.), and bsd style (do not use - to guide option, to use one letter to represent option, and can be written in conjunction, such as ps aux , tar xvf file.tar , < It is a typical BSD style) and so on


General convention. A - stands for shorthand. Both indicate full write, or the command contains -


is theoretically a string, that is, the use of a string, with or without-- can

but most of them will bring-- this should be regarded as a convention


agrees with @ Feng_Yu , but there is another way to write it that is neither easy to remember nor good-looking. For example, see the explanation of gcc's command line argument-Wall:

https://gcc.gnu.org/onlinedoc.

The

-Wall parameter contains the following parameters by default:

-Waddress
-Warray-bounds=1 (only with-O2)
-Wbool-compare
-Wbool-operation
-WcPP11-compat-WcPP14-compat
-Wcatch-value (CPP and Objective-CPP only)
.

Menu