ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stein Inge Morisbak <Stein.Inge.Moris...@BEKK.no>
Subject ant exec task: ssh username contains spaces, how to escape?
Date Tue, 01 Feb 2011 20:24:16 GMT
I am trying to call ssh using the ant exec task from maven. My problem is that I can't figure
out how to escape spaces in usernames. I have tried:

<exec executable="sed" failonerror="true" inputstring="stein inge morisbak" outputproperty="username">
   <arg value="s/ /\\ /g" />
</exec>

<exec executable="ssh" failonerror="true">
   <arg value="${username}@localhost" />
   <arg value="if [ -f /tmp/test.txt ]; then rm -f /tmp/test.txt ; fi" />
</exec>


... and also:

<exec executable="ssh" failonerror="true">
   <arg value="&quot;stein inge morisbak&quot;@localhost" />
   <arg value="if [ -f /tmp/test.txt ]; then rm -f /tmp/test.txt ; fi" />
</exec>

... and finally:

<exec executable="ssh" failonerror="true">
   <arg value="'stein inge morisbak'@localhost" />
   <arg value="if [ -f /tmp/test.txt ]; then rm -f /tmp/test.txt ; fi" />
</exec>

... but no luck :-(

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


Mime
View raw message