相关疑难解决方法(0)

“--”(双破折号)是什么意思?

--compgen命令中看到使用过。

例如:

compgen -W "foo bar baz" -- b
Run Code Online (Sandbox Code Playgroud)

里面的意思是什么--

command-line shell utilities syntax

659
推荐指数
5
解决办法
25万
查看次数

当模式包含连字符“-”时与 grep 匹配

我编写了以下命令以将 $a 与 $b 匹配,但是当该值包含“-”时,我会收到错误消息。我怎样才能避免这种情况?

# a="-Xmx5324m"
# b="-Xmx5324m"
#
#
#  echo "$a"  | grep -Fxc "$b"
grep: conflicting matchers specified
Run Code Online (Sandbox Code Playgroud)

grep special-characters

16
推荐指数
2
解决办法
9370
查看次数

grep 连字符选项命令的手册页

当我搜索find匹配命令的手册页时,type它会返回很多我不想要的搜索结果。相反,我想用一个命令,它返回在搜索结果-type

该命令man find | grep -type不起作用。它返回:

grep: invalid option -- 't'
Run Code Online (Sandbox Code Playgroud)

grep man options

11
推荐指数
1
解决办法
6507
查看次数

命令 grep 中的 -e 选项

我在阅读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 选项指定多个模式时,此选项最有用”

但是,这是什么意思?

"或者当模式以破折号 (`-') 开头时。"

你能举个例子吗?

grep syntax

0
推荐指数
1
解决办法
1375
查看次数