You can think of the [[
...]]
as a control character sequence that signals to bash to evaluate whatever expression is found in between them as a conditional expression.
Likewise, the *
is also a special control character, which tells bash to "match anything". As you get more adept with programming, you will learn that it's proper name is a meta character but that's not important for now.
To learn about bash conditional expressions, you can type man bash
on your terminal then skip to the section by entering /, and on the resulting prompt, typeing CONDITIONAL EXPRESSIONS
followed by Enter. You may need to type n
a few times to get to the actual section.
Have fun as you learn.
help [[
, but nothing in the code you show makes sense so we cannot really tell you "why". – terdon May 03 '22 at 12:01bash
– Chris Davies May 03 '22 at 17:19