You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by cortez21 <co...@wp.pl> on 2017/10/17 14:49:00 UTC
Cannot execute shell scripts/command separated by ";" with
execute() method
Hi All,
Maybe you can help me with issue I have with executing linux command
separated by ";".
I am using execute function but got error:
No such file or directory
but file exist.
Code I am executing:
cmdArgs = ["/opt/test.sh; sqlplus username"];
cmdArgs.execute(env, workDir);
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
Re: Cannot execute shell scripts/command separated by ";" with
execute() method
Posted by Basurita <ba...@gmail.com>.
On 10/17/17 12:07 PM, Paolo Di Tommaso wrote:
> Do
>
> cmdArgs = ["bash", "-c", "/opt/test.sh; sqlplus username" ];
> cmdArgs.execute(env, workDir);
>
Just to clarify:
The parsing of the command line (such as separating commands with ; ) is done by the shell.
That's why the above code works.
You are executing "bash" and passing it the "command line" so it can be interpreted and executed.
BBB
> On Tue, Oct 17, 2017 at 4:49 PM, cortez21 <cortez21@wp.pl <ma...@wp.pl>> wrote:
>
> Hi All,
>
> Maybe you can help me with issue I have with executing linux command
> separated by ";".
> I am using execute function but got error:
>
> No such file or directory
>
> but file exist.
>
> Code I am executing:
>
> cmdArgs = ["/opt/test.sh; sqlplus username"];
> cmdArgs.execute(env, workDir);
>
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html <http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html>
>
>
Re: Cannot execute shell scripts/command separated by ";" with
execute() method
Posted by Paolo Di Tommaso <pa...@gmail.com>.
Do
cmdArgs = ["bash", "-c", "/opt/test.sh; sqlplus username" ];
cmdArgs.execute(env, workDir);
p
On Tue, Oct 17, 2017 at 4:49 PM, cortez21 <co...@wp.pl> wrote:
> Hi All,
>
> Maybe you can help me with issue I have with executing linux command
> separated by ";".
> I am using execute function but got error:
>
> No such file or directory
>
> but file exist.
>
> Code I am executing:
>
> cmdArgs = ["/opt/test.sh; sqlplus username"];
> cmdArgs.execute(env, workDir);
>
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>