Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #21334
| X-Received | by 10.68.224.130 with SMTP id rc2mr14105237pbc.2.1357933260702; Fri, 11 Jan 2013 11:41:00 -0800 (PST) |
|---|---|
| Received | by 10.50.184.193 with SMTP id ew1mr102806igc.12.1357933260664; Fri, 11 Jan 2013 11:41:00 -0800 (PST) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!f6no2255088pbd.1!news-out.google.com!6ni101623pbd.1!nntp.google.com!f6no2255084pbd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.java.programmer |
| Date | Fri, 11 Jan 2013 11:41:00 -0800 (PST) |
| In-Reply-To | <05a24a02-1ac3-4866-ba2b-20c488793b96@googlegroups.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=130.76.32.78; posting-account=_7xgmwoAAADi7iXKBO-oX5zbCfSzsCV0 |
| NNTP-Posting-Host | 130.76.32.78 |
| References | <05a24a02-1ac3-4866-ba2b-20c488793b96@googlegroups.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <4600dcb5-1819-4e5b-aeae-70162d97144d@googlegroups.com> (permalink) |
| Subject | Re: problem with multiword args and Runtime.exec() |
| From | FredK <fred.l.kleinschmidt@gmail.com> |
| Injection-Date | Fri, 11 Jan 2013 19:41:00 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Xref | csiph.com comp.lang.java.programmer:21334 |
Show key headers only | View raw
On Friday, January 11, 2013 8:33:39 AM UTC-8, Aryeh M. Friedman wrote: > No matter what version of Runtime.exec I call I can not make a arg that has multiple words in it (*NOT* multiple args but a single one) for example if I need to issue the following command in unix I can not find a way to do the stuff in "'s as a single arg [the called program requires this... i.e. it *MUST NOT* be treated as different elements of String[] args if it was a java program]): > > > > rdiff-backup --remote-schema "ssh -C -p9222 %s rdiff-backup --server" username@remoteserver::/path_to/filestobackup /path_to/backedupfiles Your program gets the quotes string as a single argument. If you want to pass that string as a single argument to something like system(), you have to ensure that there are quotes around the multi-word argument. For example, assume arg1 contains the multiword value. You cannot just say: sprintf( buffer, "ls %s", arg1 ); system( buffer ); you have to use sprintf( buffer, "ls '%s'", arg1 ); system( buffer ); -- Fred K
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
problem with multiword args and Runtime.exec() "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> - 2013-01-11 08:33 -0800
Re: problem with multiword args and Runtime.exec() Lew <lewbloch@gmail.com> - 2013-01-11 11:07 -0800
Re: problem with multiword args and Runtime.exec() FredK <fred.l.kleinschmidt@gmail.com> - 2013-01-11 11:41 -0800
Re: problem with multiword args and Runtime.exec() FredK <fred.l.kleinschmidt@gmail.com> - 2013-01-11 11:44 -0800
Re: problem with multiword args and Runtime.exec() "A. Bolmarcich" <aggedor@earl-grey.cloud9.net> - 2013-01-11 15:27 -0600
Re: problem with multiword args and Runtime.exec() Martin Gregorie <martin@address-in-sig.invalid> - 2013-01-11 21:36 +0000
csiph-web