热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

LinuxShell脚执行时不保存到临时变量

如果我想在其中执行包含变量的命令,我总是必须先将字符串存储在变量中,然后才能执行它…例:path_fasta=/home/xxx/yyy/zzz/qqq

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

例:

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


推荐阅读
author-avatar
萧阳
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有