Linux Shell脚执行时不保存到临时变量

Mic*_*ael 3 linux bash

如果我想在其中执行包含变量的命令,我总是必须先将字符串存储在变量中,然后才能执行它...

例:

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
Run Code Online (Sandbox Code Playgroud)

如何直接执行此操作而不先将其存储在temp中?一定很容易,但没有找到解决方案......

Bri*_*ain 5

代替:

temp='find . -maxdepth 1 -not -name '$name_fasta' -not -name letsgo.sh -delete'
$temp
Run Code Online (Sandbox Code Playgroud)

......只是使用:

find . -maxdepth 1 -not -name "$name_fasta" -not -name letsgo.sh -delete
Run Code Online (Sandbox Code Playgroud)