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

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

例:

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

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...