我正在嘗試執行「who -m」來自Apache ant的命令,但未成功。從螞蟻執行who -m
這裏是我的ant腳本:
<?xml version="1.0" encoding="UTF-8"?>
<project name="default" default="who.am.i">
<target name="who.am.i">
<exec executable="who" outputproperty="myOutput">
<arg value="-m"/>
</exec>
<echo message="I am = ${myOutput}"/>
</target>
</project>
結果是空白。
[echo] I am =
如果我不帶參數運行EXEC,它會顯示正確的結果:
<exec executable="who" outputproperty="myOutput">
</exec>
[echo] host.name = gary tty8 2014-02-03 12:04 (:0)
[echo] gary pts/0 2014-02-03 12:09 (:0)
[echo] gary pts/1 2014-02-03 12:23 (:0)
[echo] gary pts/2 2014-02-04 11:36 (:0)
[echo] gary pts/4 2014-02-05 13:27 (:0)
[echo] gary pts/7 2014-02-04 12:23 (:0)
[echo] gary pts/8 2014-02-06 12:44 (:0)
如果我運行誰從終端-m命令會顯示什麼,我在尋找:
who -m
gary pts/8 2014-02-06 12:44 (:0)
任何想法爲什麼螞蟻不接受-m參數?
沒有成功試了一下,決定去的.bashrc路線 – javapenguin