如果我想在其中执行包含变量的命令,我总是必须先将字符串存储在变量中,然后才能执行它…
例:
path_fasta="/home/xxx/yyy/zzz/qqq/"
name_fasta="CTA_Mix_DNA.fna"
path_outp"/some/Path/"
temp='find . -maxdepth 1 -not -name '$name_fasta' -not -name letsgo.sh -delete'
$temp
temp=$path_mothur'mothur #set.dir(output='$path_outp');summary.seqs(fasta='$path_fasta''$name_fasta')'
$temp
如何直接执行此操作而不先将其存储在temp中?一定很容易,但没有找到解决方案……
解决方法:
代替:
temp='find . -maxdepth 1 -not -name '$name_fasta' -not -name letsgo.sh -delete'
$temp
……只是使用:
find . -maxdepth 1 -not -name "$name_fasta" -not -name letsgo.sh -delete