You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Michael Heuer <he...@acm.org> on 2009/03/12 18:40:01 UTC
[CLI1.x] quoted arguments split into multiple values
Hello,
With cli 1.1 and the java class wrapped with a bash script, quoted
arguments are split into multiple values.
myclass.sh:
#!/bin/bash
java MyClass $@
e.g.
$ myclass.sh --foo "Foo Bar"
Option foo = ...;
Options options = ...;
CommandLineParser parser = ...;
CommandLine commandLine = parser.parse(options, args);
String value = foo.getValue();
// expected value "Foo Bar", was "Foo"
Is this a problem with cli or with the bash script?
michael
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [CLI1.x] quoted arguments split into multiple values
Posted by Michael Heuer <he...@acm.org>.
J�rg Schaible wrote:
> Hi Michael,
>
> Michael Heuer wrote:
>
> > Hello,
> >
> > With cli 1.1 and the java class wrapped with a bash script, quoted
> > arguments are split into multiple values.
> >
> > myclass.sh:
> >
> > #!/bin/bash
> >
> > java MyClass $@
> >
> >
> > e.g.
> >
> > $ myclass.sh --foo "Foo Bar"
> >
> >
> > Option foo = ...;
> > Options options = ...;
> > CommandLineParser parser = ...;
> > CommandLine commandLine = parser.parse(options, args);
> > String value = foo.getValue();
> > // expected value "Foo Bar", was "Foo"
> >
> >
> > Is this a problem with cli or with the bash script?
>
> Bash. You want "$@".
That works, thanks.
michael
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [CLI1.x] quoted arguments split into multiple values
Posted by Jörg Schaible <jo...@gmx.de>.
Hi Michael,
Michael Heuer wrote:
> Hello,
>
> With cli 1.1 and the java class wrapped with a bash script, quoted
> arguments are split into multiple values.
>
> myclass.sh:
>
> #!/bin/bash
>
> java MyClass $@
>
>
> e.g.
>
> $ myclass.sh --foo "Foo Bar"
>
>
> Option foo = ...;
> Options options = ...;
> CommandLineParser parser = ...;
> CommandLine commandLine = parser.parse(options, args);
> String value = foo.getValue();
> // expected value "Foo Bar", was "Foo"
>
>
> Is this a problem with cli or with the bash script?
Bash. You want "$@".
- Jörg
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org