shell 判断字符串/文件是否存在

str="this is a string"

[[ $str =~ "this" ]] && echo "$str contains this"

判断文件:

if [ -f $fq1 ]
then
fq2=`ls /home/input${RGID}/*_2.fq.gz`
else
fq1=`ls /home/input${RGID}/*_1.fastq.gz`
fq2=`ls /home/input${RGID}/*_2.fastq.gz`
fi

 

posted on 2020-09-09 04:15  BioinformaticsMaster  阅读(1265)  评论(0编辑  收藏  举报

导航