早教吧作业答案频道 -->其他-->
linux小数点如何相加/bin/shus=`top-n1|awk'{print$2}'|sed-n3p|sed's/%//g'`sy=`top-n1|awk'{print$4}'|sed-n3p|sed's/%//g'`total=`expr$us+$sy`出错提示expr:non-numericargumentecho$us>/will/us.txtecho$sy>/will/s
题目详情
linux 小数点如何相加
/bin/sh
us=`top -n 1 | awk '{print $2}' |sed -n 3p | sed 's/%//g'`
sy=`top -n 1 | awk '{print $4}' |sed -n 3p | sed 's/%//g'`
total=`expr $us + $sy`出错提示expr:non-numeric argument
echo $us > /will/us.txt
echo $sy > /will/sy.txt
echo $total > total.txt
/bin/sh
us=`top -n 1 | awk '{print $2}' |sed -n 3p | sed 's/%//g'`
sy=`top -n 1 | awk '{print $4}' |sed -n 3p | sed 's/%//g'`
total=`expr $us + $sy`出错提示expr:non-numeric argument
echo $us > /will/us.txt
echo $sy > /will/sy.txt
echo $total > total.txt
▼优质解答
答案和解析
shell不可直接进行小数运算,可以用去其他方法,这是我想到的1:用bc方法,你可以去查查echo $us+$sy | bc如我的结果# echo $a8.8# echo $b9.1# echo $a+$b | bc17.92:用awk方法# awk -v a=$a -v b=$b 'BEGIN{print a+...
看了linux小数点如何相加/bi...的网友还看了以下:
英语单选难点It would be a good idea to use a plastic bo 2020-05-13 …
matlab求微分方程,常数项比如y=dsolve("Du=((a-u-b)*e-u*d)/(e* 2020-05-14 …
(交集,并集)已知全集U={1,2,3,4,5,6,7,8,9,},A包含于U,B包含于U,且(C 2020-05-16 …
经观测,某公路段在某时段内的车流量y(千辆/小时)与汽车的平均速度u(千米/小时)之间有函数关系y 2020-05-17 …
设Φ(u,v)具有连续偏导数,证明由方程Φ(cx-az,cy-bz)=0所确定的函数z=f(x,y 2020-05-17 …
设a=(cos23°,cos67°),b=(cos68°,cos22°)u=a+tb(t属于R)求 2020-05-19 …
ln(u)+u=0的方程怎么解?请问ln(u)+u=0或a*u*exp(u)-b*u类似的方程怎么 2020-05-20 …
电磁学H=n*I/l,请问H是什么?n:匝数,I:电流,l:线圈长度)H=n*I/l,请问H是什么 2020-06-08 …
AUTOCAD使用以下失量参数方程式创建椭圆弧.p(u)=c+a*cos(u)+b*sin(u), 2020-07-29 …
我想通过matlab求解下列六元字母系数的方程组,输入代码如下,但x0~x4结果均为零,请问问题出 2020-08-02 …