if语句麻烦

if语句麻烦

我编写了以下脚本:

#!/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

但是 if 语句似乎有问题。Bash 返回以下错误:

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'

我一直在考虑在 of 中编写一个 AND 运算符,但似乎没问题,我不确定那里出了什么问题。任何想法?

谢谢

答案1

看来您忘记了关闭大括号之前的空格。应该是这样

if [[ -r "${i}_Forward_Trimmed.fa" && -r ../REVERSE_COMP/"${i}_Reverse_RevComp.fa" ]]

相关内容