我需要执行我的 evaluateParameters.pl Perl 程序,为此,我想创建一个 shell 脚本。
#!/bin/bash
COVARIANCE=~/Desktop/ncRNA/CovarianceModels/rRNAs_cov/bitscores.rRNA.dat # First input FILE
BASEPATH='/Desktop/ncRNA/Data/Inputs/rRNAs/60/'
TRUEFILES=~/$BASEPATH/Infernal/*.table # Second input File
CONTROLFILES=~/$BASEPATH/RandomControl/Infernal/*.table # third input file
INPUTFILES=~/$BASEPATH/*.fasta # fourth input file
for i in $COVARIANCE
do
NAME1=`basename $i`
for t in $TRUEFILES
do
# i.e : 1dvex4_rRNA_cin.out.db.location.fasta.RF00001.cm.tab.table
NAME=`basename $t`
echo "Calculating the parameters to $NAME"
# I need modify $NAME to convert in: 1dvex4_rRNA.cin.out.db.location.fasta
FILER=$(echo $NAME | sed s/(.*\.fasta)\.(.*\.tab\.table)/\1/g)
# I need modify $NAME to convert in:
# 1dvex4_rRNA.cin.out.db.location.fasta.mutant.fasta.RF00001.cm.tab.table
FILEM=$(echo $NAME | sed s/(.*\.fasta\.)(.*\.tab\.table)/\1\.mutate\.fasta\2/g)
perl evaluateParameters.pl $i ~/$BASEPATH/Infernal/$NAME ~/$BASEPATH/RandomControl/Infernal/$FILEM ~/$BASEPATH/$FILER
echo "END!"
done
done
最后一个代码向我发送以下警告:
Calculating the parameters to 10dvex1_rRNA_ce.out.db.location.fasta.RF00001.cm.tab.table.false.table.false.table.true.table.true.table.true.table .false.table
./obtainParameters.sh: command substitution: line 31: syntax error near unexpected token `('
./obtainParameters.sh: command substitution: line 31: `echo $NAME | sed s/(.*\.fasta)\.(.*\.tab\.table)/\1/g'
./obtainParameters.sh: command substitution: line 32: syntax error near unexpected token `('
./obtainParameters.sh: command substitution: line 32: `echo $NAME | sed s/(.*\.fasta\.)(.*\.tab\.table)/\1\.mutate\.fasta\2/g'
一些想法?我猜错误在 $NAME 的正则表达式中,但我无法获得正确的正则表达式结果。提前致谢!