我--在compgen命令中看到使用过。
例如:
compgen -W "foo bar baz" -- b
Run Code Online (Sandbox Code Playgroud)
里面的意思是什么--?
我编写了以下命令以将 $a 与 $b 匹配,但是当该值包含“-”时,我会收到错误消息。我怎样才能避免这种情况?
# a="-Xmx5324m"
# b="-Xmx5324m"
#
#
# echo "$a" | grep -Fxc "$b"
grep: conflicting matchers specified
Run Code Online (Sandbox Code Playgroud) 当我搜索find匹配命令的手册页时,type它会返回很多我不想要的搜索结果。相反,我想用一个命令,它返回仅在搜索结果-type。
该命令man find | grep -type不起作用。它返回:
grep: invalid option -- 't'
Run Code Online (Sandbox Code Playgroud) 我在阅读grep手册时遇到了一个问题,提到它的-e选项,
它说:
-e pattern, --regexp=pattern
Specify a pattern used during the search of the input: an input
line is selected if it matches any of the specified patterns.
This option is most useful when multiple -e options are used to
specify multiple patterns, or when a pattern begins with a dash
(`-').
Run Code Online (Sandbox Code Playgroud)
我对e缩写是什么感到困惑?谷歌搜索不到答案。
此外,很容易理解的是
“当使用多个 -e 选项指定多个模式时,此选项最有用”
但是,这是什么意思?
"或者当模式以破折号 (`-') 开头时。"
你能举个例子吗?