bash中的[[$-= * i *]]是什么意思?
我正在安装 liquidprompt ,他们在文档中要求您添加 [[$-= * i *]]&&来源〜/liquidprompt/liquidprompt
在您的 .bashrc
中.
I'm installing liquidprompt and in the documentation they ask you to add [[ $- = *i* ]] && source ~/liquidprompt/liquidprompt
in your .bashrc
.
我试图理解该系列的第一部分,但是对于像我这样的bash菜鸟来说,这很难.如果有人有一个不错的文档或答案...
I am trying to understand the first part of the line but it's hard for a noob in bash like me. If anyone has a nice doc or the answer...
$-
包含当前的shell选项.
$-
contains the current shell options.
在 [[... ...]]
中,如果未引用,则将 =
的右侧解释为模式.因此, * i *
表示 i
可能在任何内容之前或之后.
In [[ ... ]]
, the right hand side of a =
is interpreted as a pattern if not quoted. Therefore, *i*
means i
possibly preceded or followed by anything.
换句话说,它将检查是否存在 i
选项,即当前shell是否是交互式的.
In other words, it checks wheter the i
option is present, i.e. whether the current shell is interactive.