使用八度无头 [英] Using octave headless
本文介绍了使用八度无头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用无头八度音阶.
Is there a possibility to use Octave headless.
像这样的事情
octave < "5+4" >result.txt
Something like this
octave < "5+4" >result.txt
推荐答案
使用
octave --silent --eval 5+4 > result.txt
你会得到
ans = 9
result.txt
中的
.有关命令行参数的详细信息,请参见octave --help
.
但是,这个臭名昭著的ans =
可以使用sed
删除,例如
Yet, there is this infamous ans =
that might be remove using sed
, e.g.
octave --silent --eval 'x=5+4; y=x+1; disp(y)' | sed -e 's/ans = //' >> result.txt
在result.txt
中添加适当的结果(10
).
which add the appropriate result (10
) in result.txt
.
将其包装到bash
脚本中应该不太困难.
It should not be too hard to wrap this into a bash
script.
这篇关于使用八度无头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文