You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Lemke, Wesley" <We...@LibertyMutual.com> on 2006/01/26 22:11:55 UTC

Escaping Characters

We are prompting for a cvs password in our ant script.  However, we have
some users that have special characters in their password (! for
example).

How do I escape the special characters, before I send the cvs command to
the system?

Here is the relevant parts of our build.xml:

	<target name="get-password" unless="cvs.pass">
		<input addproperty="cvs.pass"
			   message="Please enter your CVS password for
${cvs.user} on ${cvs.host}" />
	</target>

Later we build the cvs command like this:

value=":pserver:${cvs.user}:${cvs.pass}@${cvs.host}:${cvs.code.repositor
y.dir}"

If someone's password is:  th!s
I would like cvs.pass to be: th\!s

How do I accomplish this?

Wes Lemke
Agency Markets IT
8-206-3213


Re: Escaping Characters

Posted by Dominique Devienne <dd...@gmail.com>.
On 1/26/06, Lemke, Wesley <We...@libertymutual.com> wrote:
> How do I escape the special characters, before I send the cvs command to
> the system?

> value=":pserver:${cvs.user}:${cvs.pass}@${cvs.host}:${cvs.code.repository.dir}"
>
> If someone's password is:  th!s
> I would like cvs.pass to be: th\!s

Why would it be necessary? Does it not work for some of your users?

One usually needs to escape characters so that the shell passes them
unmolested to the app it's about to start to run the command. But when
you use <exec>, or <cvs> which uses Execute underneath, you don't go
thru a shell usually.

Otherwise, check out Ant-Contrib on SourceForge, which has tools to
manipulate property text. --DD

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