Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade Newsgroups: comp.lang.java.programmer Subject: Re: exec problem is JDK 1.7.0_21 Date: Wed, 24 Apr 2013 11:24:06 +0100 Lines: 29 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net 3miRqRgBs4GzBb1PtxIpwgb2zS+RjOsp4LZX1tMT1elcJNRYER Cancel-Lock: sha1:EYaNwELC2QJIaPSoSSW69FkBXUc= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120601 Thunderbird/13.0 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:23620 On 23/04/13 22:05, Martin Gregorie wrote: > On Tue, 23 Apr 2013 23:28:35 +0300, Sven Köhler wrote: > >> Am 23.04.2013 00:07, schrieb Martin Gregorie: >>> My testprog works exactly the same when run from within my >>> TestProcessBuilder test class as it does when run stand-alone from the >>> command line: >>> >>> $ java TestProcessBuilder testprog "hello world" "\"hello world\"" >>> "\"hello\" \"world\"" "hello ""double quoted"" world" >>> argc=5 argv[0]=testprog argv[1]=hello world argv[2]="hello world" >>> argv[3]="hello" "world" >> >> Please look at the results that Steven posted. If the String "hello\" >> \"world" is passed to the ProcessBuilder, the result was: >> argv[1]=[hello] argv[2]=[world] >> > Actually, on Linux almost all the messing about with strings is done by > the shell that invokes the the command if the strings are enclosed in > double quotes. Only if the command invokes a shell, otherwise there is no shell involved. The shell is just another executable. -- Nigel Wade