I have a shell script which gets executed. In the script I have:
if [[ $variable == *something* ]]; then
do something
fi
My issue here is that running the script returns “[[ not found”.
From reading other answers, it looks like not all shells recognize double brackets, however, I am not sure what the solution is, what is the equivalent of that code?
It sounds like your shell is POSIX
sh, which does not have the[[builtin. Possible solutions include translating it to an expression that works forshor changing the shebang line to be#!/bin/bash. Changing the shebang is generally the best solution.You may have a POSIX
shif you’re on Ubuntu, they use dash.