Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

为什么我们的工具栏参数需要加一个 -- #963

Answered by Arondight
mark9804 asked this question in Q&A
Discussion options

You must be logged in to vote

文档

From man 1 getopt ...

The special argument  "--" forces an end of option-scanning regardless of the scanning mode.

人话

约定当处理参数的库遇到选项 -- 时,表示其后的所有参数均不是选项。

实战

pushd /tmp/
touch -- -h
ls -l -- -h
rm -vf -- -h
popd

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Arondight
Comment options

@mark9804
Comment options

mark9804 Nov 22, 2022
Collaborator Author

@Arondight
Comment options

@mark9804
Comment options

mark9804 Nov 22, 2022
Collaborator Author

Answer selected by mark9804
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants