keyword

Closing double bracket

Terminates a Bash conditional expression. The conditional has special expansion and pattern rules; quoting the pattern operand makes it literal.

Formal Syntax & Structure

bash syntaxbash
[[ expression ]]

Return Value

exit status

Terminates a Bash conditional expression. The conditional has special expansion and pattern rules; quoting the pattern operand makes it literal.

Working Example

Example Snippetbash
target='daily report.txt'printf 'ready\n' > "$target"cat -- "$target"pattern='*.txt'[[ $target == $pattern ]] && printf 'pattern=yes\n'[[ $target == "$pattern" ]] || printf 'literal=no\n'
Bash Reference