微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐