You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by viet nguyen <vi...@gmail.com> on 2009/03/06 15:44:49 UTC

how to "echo" exec command

how do I "echo" or display the full command exec is about to run?  In my
example I should see 
[exec] VBoxManage controlvm vm poweroff
but nothing is shown.

ant version=1.7 os = fedora 10 shell=bash, jdk=1.5.8

    <target name="vbox" depends="-init-run">
        <exec executable="VBoxManage" failifexecutionfails="false">
            <arg line="controlvm ${vbox.vmname} poweroff"/>
        </exec>        
     ....

vbox:
     [exec] 
     [exec] VirtualBox Command Line Management Interface Version 2.1.4
     [exec] (C) 2005-2009 Sun Microsystems, Inc.
     [exec] All rights reserved.

-- 
View this message in context: http://www.nabble.com/how-to-%22echo%22-exec-command-tp22373827p22373827.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: how to "echo" exec command

Posted by David Weintraub <qa...@gmail.com>.
I take it you're a Windows person. The "echo on" and "echo off"
parameters are really part of the CMD.EXE "DOS" shell on Windows. It's
not a feature of Ant or of the OS.

When you use the <exec> command, you are running the command without the shell.

What you can do, if you really want to do this is run the command
through "cmd.exe" instead of doing it directly. That way, you get the
full power of the shell. Of course, it is slower, but it might get
what you want.

Something like this:

<exec executable="cmd.exe"
    failifexecutionfails="false">
    <arg line="/C VBoxManage controlvm {vbox.vmname} poweroff"/>
</exec>


<target name="vbox" depends="-init-run">
>        <exec executable="VBoxManage" failifexecutionfails="false">
>            <arg line="controlvm ${vbox.vmname} poweroff"/>
>        </exec>


On Fri, Mar 6, 2009 at 9:44 AM, viet nguyen <vi...@gmail.com> wrote:
>
> how do I "echo" or display the full command exec is about to run?  In my
> example I should see
> [exec] VBoxManage controlvm vm poweroff
> but nothing is shown.
>
> ant version=1.7 os = fedora 10 shell=bash, jdk=1.5.8
>
>    <target name="vbox" depends="-init-run">
>        <exec executable="VBoxManage" failifexecutionfails="false">
>            <arg line="controlvm ${vbox.vmname} poweroff"/>
>        </exec>
>     ....
>
> vbox:
>     [exec]
>     [exec] VirtualBox Command Line Management Interface Version 2.1.4
>     [exec] (C) 2005-2009 Sun Microsystems, Inc.
>     [exec] All rights reserved.
>
> --
> View this message in context: http://www.nabble.com/how-to-%22echo%22-exec-command-tp22373827p22373827.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
--
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: AW: how to "echo" exec command

Posted by viet nguyen <vi...@gmail.com>.
Thanks for getting back to me.

I'm aware of -verbose and -debug but they generate too much much
information.  I'm looking for something simple and analogous to @ in DOS
batch file.

I guess I can write an exec macrodef and print the command as Martin
suggested.






Jan.Materne wrote:
> 
> Start Ant with -verbose or -debug.
> 
> Jan 
> 
>>-----Ursprüngliche Nachricht-----
>>Von: viet nguyen [mailto:viet.atx@gmail.com] 
>>Gesendet: Freitag, 6. März 2009 15:45
>>An: user@ant.apache.org
>>Betreff: how to "echo" exec command
>>
>>
>>how do I "echo" or display the full command exec is about to 
>>run?  In my
>>example I should see 
>>[exec] VBoxManage controlvm vm poweroff
>>but nothing is shown.
>>
>>ant version=1.7 os = fedora 10 shell=bash, jdk=1.5.8
>>
>>    <target name="vbox" depends="-init-run">
>>        <exec executable="VBoxManage" failifexecutionfails="false">
>>            <arg line="controlvm ${vbox.vmname} poweroff"/>
>>        </exec>        
>>     ....
>>
>>vbox:
>>     [exec] 
>>     [exec] VirtualBox Command Line Management Interface Version 2.1.4
>>     [exec] (C) 2005-2009 Sun Microsystems, Inc.
>>     [exec] All rights reserved.
>>
>>-- 
>>View this message in context: 
>>http://www.nabble.com/how-to-%22echo%22-exec-command-tp22373827
>>p22373827.html
>>Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-%22echo%22-exec-command-tp22373827p22374727.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: how to "echo" exec command

Posted by Ja...@rzf.fin-nrw.de.
Start Ant with -verbose or -debug.

Jan 

>-----Ursprüngliche Nachricht-----
>Von: viet nguyen [mailto:viet.atx@gmail.com] 
>Gesendet: Freitag, 6. März 2009 15:45
>An: user@ant.apache.org
>Betreff: how to "echo" exec command
>
>
>how do I "echo" or display the full command exec is about to 
>run?  In my
>example I should see 
>[exec] VBoxManage controlvm vm poweroff
>but nothing is shown.
>
>ant version=1.7 os = fedora 10 shell=bash, jdk=1.5.8
>
>    <target name="vbox" depends="-init-run">
>        <exec executable="VBoxManage" failifexecutionfails="false">
>            <arg line="controlvm ${vbox.vmname} poweroff"/>
>        </exec>        
>     ....
>
>vbox:
>     [exec] 
>     [exec] VirtualBox Command Line Management Interface Version 2.1.4
>     [exec] (C) 2005-2009 Sun Microsystems, Inc.
>     [exec] All rights reserved.
>
>-- 
>View this message in context: 
>http://www.nabble.com/how-to-%22echo%22-exec-command-tp22373827
>p22373827.html
>Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: how to "echo" exec command

Posted by Martin Gainty <mg...@hotmail.com>.
you can 
<echo>put your entire command line here</echo>

or redirect exec stdout with the ant exec task 'output' attribute e.g.
<exec executable="VBoxManage" failifexecutionfails="false" output="Somefile.txt">
 <arg line="controlvm ${vbox.vmname} poweroff"/>
</exec>        

and view the contents of 'Somefile.txt' after execution

http://ant.apache.org/manual/CoreTasks/exec.html

HTH
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Date: Fri, 6 Mar 2009 06:44:49 -0800
> From: viet.atx@gmail.com
> To: user@ant.apache.org
> Subject: how to "echo" exec command
> 
> 
> how do I "echo" or display the full command exec is about to run?  In my
> example I should see 
> [exec] VBoxManage controlvm vm poweroff
> but nothing is shown.
> 
> ant version=1.7 os = fedora 10 shell=bash, jdk=1.5.8
> 
>     <target name="vbox" depends="-init-run">
>         <exec executable="VBoxManage" failifexecutionfails="false">
>             <arg line="controlvm ${vbox.vmname} poweroff"/>
>         </exec>        
>      ....
> 
> vbox:
>      [exec] 
>      [exec] VirtualBox Command Line Management Interface Version 2.1.4
>      [exec] (C) 2005-2009 Sun Microsystems, Inc.
>      [exec] All rights reserved.
> 
> -- 
> View this message in context: http://www.nabble.com/how-to-%22echo%22-exec-command-tp22373827p22373827.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

_________________________________________________________________
Windows Live™ Contacts: Organize your contact list. 
http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009