Coder Perfect

In a shell script, what does the “=” operator mean? [duplicate]

Problem

I came discovered a shell script with the following code:

for line in $LIST_ARRAY;do
if [[ $LIST_ARRAY =~ $line ]]
then
echo "true"
....
...
.

In this example, what is the significance of =?

Asked by cc4re

Solution #1

it’s the Equal Tilde operator that allows the use of regex in an if statement.

http://linux.die.net/man/1/bash

Answered by MimiEAM

Post is based on https://stackoverflow.com/questions/12454731/meaning-of-operator-in-shell-script