I am creating a script using bash. However during the IF statement it raises this error: [[: not found
.
I read this topic in other posts but it seems that my predecessors were writing bad their code (e.g. forgetting spaces or else). My question is a little bit different because THE SAME code if run within other parts does not work but if I launch it totally alone it correctly works.
Why does this happens? I permit that the variable used is the only one along the whole code.
echo "Digit how many codon positions do you want to use for your partition. [2-3]"
read codonpos
echo $codonpos
[[ "$codonpos" = "2" ]] && echo im here
I also tried:
echo "Digit how many codon positions do you want to use for your partition. [2-3]"
read codonpos
echo $codonpos
if [[ "$codonpos" = "2" ]]
then
echo im here
fi
I repeat you that if launch independently it works but, if this is embedded in a larger code it doesn't.