1

I've written the following script:

#!/bin/bash

SINGLE=`cut -c 7-13 Data.txt`

cd ../FASTA_SEC_EDITED/

for i in ${SINGLE}; do
    if [[ -r "${i}_Forward_Trimmed.fa" && -r ../REVERSE_COMP/"${i}_Reverse_RevComp.fa"]]
    then
        cp ${i}_Forward_Trimmed.fa ../Aling/Input_Muscle/${i}_Input.fa >> ../REVERSE_COMP/${i}_Reverse_RevComp.fa
        usr/bin/muscle3.8.31_i86linux64 -in ../Aling/Input_Muscle/${i}_Input.fa -out ../Align/${i}_CONSENSUS.fa

    else
        echo "Does not exist"
    fi
done

But but something seems to be wrong with the if statement.. Bash returns the following error:

muscle_test.sh: line 8: syntax error in conditional expression
muscle_test.sh: line 9: syntax error near `then'
muscle_test.sh: line 9: `   then'

I've been gooling about writing an AND operator in of but it seems to be ok, I'm not sure what's wrong there. Any idea?

Thank you

1 Answer 1

3

Looks like you forgot the space before closing brace. It should be so

if [[ -r "${i}_Forward_Trimmed.fa" && -r ../REVERSE_COMP/"${i}_Reverse_RevComp.fa" ]]
1
  • @Neuls if this answer solved your question, please accept it by clicking on the checkmark to the left. That's the way thanks are expressed on Stack Exchange sites and that will mark the question as answered.
    – terdon
    Dec 21, 2016 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .