What does [[ $- = *i* ]] mean in bash?

bash

Solution

`$-` contains the current shell options.

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.

In other words, it checks wheter the `i` option is present, i.e. whether the current shell is interactive.

Problem

I'm installing liquidprompt and in the documentation they ask you to add `[[ $- = *i* ]] && source ~/liquidprompt/liquidprompt` in your `.bashrc` . 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...

Original source