【发布时间】:2020-10-20 04:28:31
【问题描述】:
我将管道的输出分配给一个变量,但是当我尝试使用该变量进行数学运算时,它不允许我:
%%bash
cd /data/ref/
grep -v ">" EN | wc -c > ref
cat ref
cd /example/
grep -v ">" SR | wc -l > sample
cat sample
echo $((x= cat sample, y= cat ref, u=x/y, z=u*100))
我收到此错误:
41858
38986
bash: line 7: x= cat sample, y= cat ref, u=x/y, z=u*100: syntax error in expression (error token is "sample, y= cat ref, u=x/y, z=u*100"
【问题讨论】:
-
@user432797 : cat 这个词既不是数字,也不是变量。即使是一个变量,后面的词 sample 也没有意义。
标签: bash pipe syntax-error variable-assignment command-substitution