Hi Alex,

Alexander Fooks wrote at Montag, 23. Februar 2009 09:48:

> Hello, All,
>  
> 
> My application received parameters from the Java command line.

Well, first of all you should always prepend the subject of a message posted
to this list with the commons module you're talking about. Otherwise it is
always hard to guess and a lot of pepole will not even read your mail.


> Some of parameter names have spaces inside.
> 
> In W2K I use quotation marks and it works.
> 
> In Linux (Red Hat) the same command line doesn't work:
> 
>  
> 
> ./run1.sh -add -service -name serviceNew -application "Other TCP"
> -service_type PRIMARY -add_port TCP:DEFAULT:555

[snip]

> This is script on Linux:
> 
> java   -cp  .:./lib/commons-cli-1.1.jar cli.TestCli $*
>  
> 
> It's clear that Java VM does this wrong parsing of command line before
> of using commonCli.

Welcome to Unix shell programing. No it's not the Java VM that does it
wrong, it is your script that does not respect the shell behavior. While
the quoted param is properly passed as param to your *script*, the quotes
are the already resolved and $* is expanded with the plain value i.e.
without quotes. The Java VM has to interpret it as two params here.

> Could anybody help me?

http://www.gnu.org/software/bash/manual/bashref.html#Special-Parameters

Actually you want
 java   -cp  .:./lib/commons-cli-1.1.jar cli.TestCli "$@"

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to