bash中的[[$-= * i *]]是什么意思? [英] What does [[ $- = *i* ]] mean in bash?

查看:91
本文介绍了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.

这篇关于bash中的[[$-= * i *]]是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆