我正在尝试执行“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