linux shell编程时报:bad substitution错误的解决办法

:bad substitution错误

应该是某个变量名字打错,找不对应的值对替换,直接报错结果;
检索全文中替换的${}变量,改正即可。

示例:
我用Linux shell脚本输出一段文字生成一个R程序,报错:
/mnt/bai/yongxin/bin/ternary_16s.sh: line 1: # 説我第一行就有错,由于输出多行,内部出错,无法检查错误所在行;我最终使用了逐行/段落添加的方法,逐渐缩小错误范围,找到了报错行(原文有几百行,找了一百多行才找到,试了十几次)。其行是正文中一个变量多打一了个空格,如${height },应该为${height};下次注意,直接找变量就可以马上解决。

cat <<END >otu_ternary.r

#############################################################
# Title: Didfferent abundance OTU -- Tenary plot
# Author: Yong-Xin Liu
# E-mail: yxliu@genetics.ac.cn
# Date: 2017/6/21
# Update: 2017/6/21
# Description: Script to draw tenary plot
# Input File required in the blow list: 
# 需要DA_OTU计算各组间的差异OTU结果
# 1. "../doc/design.txt"  Design of experiment
# 2. "otu_table.txt" OTU table, better include taxonomy
# 3. "../doc/group_tern.txt" ternary list
# Group A/B/C lie in left, right and top of triangle
#############################################################
  pdf(file=paste("ter_",tern[1],tern[2],tern[3],".pdf", sep=""), height = ${height }, width = ${width})
  tern_e(per3lg[,1:3], prop=T, col=per3\$color, grid_color="black", labels_color="transparent", pch=19, main="Tenary Plot")
  dev.off()

END
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值