sh sra2fq.sh sra2fq.sh: 6: sra2f

2022-04-18  本文已影响0人  jiarf

这里运行一个脚本老报错
脚本如下:

cat sra2fq.sh
touch sra2fq.log
cd /data1/jiarongf/learning/cancer-WES/0.sra
## sra2fq.sh
cat ../data/sra2case.txt | while read id
do
   arr=(${id})
   sample=${arr[0]}.sra
   case=${arr[1]}
   echo "time fasterq-dump -p -x -3 -N -P -f --skip-technical -e 16 /data1/jiarongf/learning/cancer-WES/0.sra/${sample} -O /data1/jiarongf/learning/cancer-WES/0.sra/ >> sra2fq.log 2>&1"
   echo "sed s/${sample}/${case}/ ${sample}_1.fastq > ${case}_1.fastq "
   echo "pigz -p 16 ${case}_1.fastq"
   echo "sed s/${sample}/${case}/ ${sample}_2.fastq > ${case}_2.fastq "
   echo "pigz -p 16 -f ${case}_2.fastq"
done

但是一运行

sh sra2fq.sh
sra2fq.sh: 6: sra2fq.sh: Syntax error: "(" unexpected (expecting "done")

原因两个,第一是脚本是win的,和unix的文档字符有所差别,需要清除每行后面的一个字符,可以直接在notepad++中更改


image.png

第二就是打开的服务器sh是dash的,不是bash的,这里直接换命令即可

bash sra2fq.sh
上一篇下一篇

猜你喜欢

热点阅读