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

$- 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.

Leave a Comment