关于这条命令

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
ecsthetic
帖子: 63
注册时间: 2009-09-14 1:03

关于这条命令

#1

帖子 ecsthetic » 2009-10-17 23:01

请问一下如何把下面这条命令的返回值赋给一个变量?

echo "ibase=10;obase=2;15" | bc;

我试过了

x=echo "ibase=10;obase=2;15" | bc;

结果不行。 :em05 :em05
Using linux is a science, but the pratise of using linux itself is an art.
头像
xiooli
帖子: 6956
注册时间: 2007-11-19 21:51
来自: 成都
联系:

Re: 关于这条命令

#2

帖子 xiooli » 2009-10-17 23:17

x="`echo "ibase=10;obase=2;15" | bc`"
头像
ecsthetic
帖子: 63
注册时间: 2009-09-14 1:03

Re: 关于这条命令

#3

帖子 ecsthetic » 2009-10-17 23:22

谢谢啊,可以了。
Using linux is a science, but the pratise of using linux itself is an art.
回复