bash says '[[:' not found. what does that mean?

1

While running a bash script, I get this error:

 sh: [[: not found

How can I find what where is the problem?

mahmood

Posted 2013-11-04T21:13:39.480

Reputation: 655

Answers

6

[[ is a bash command that is not compatible with sh. Run the script with bash instead:

$ bash ./script.sh

Or edit the shebang:

#!/usr/bin/env bash

then:

$ ./script.sh

cYrus

Posted 2013-11-04T21:13:39.480

Reputation: 18 102

1Or put #!/usr/bin/env bash at the top of your script. – Dean – 2013-11-04T21:20:19.427