'system': bug or misunderstanding?

John W. Eaton jwe at bevo.che.wisc.edu
Fri Jan 4 12:29:01 CST 2008


On  1-Jan-2008, clerke wrote:

| Shouldn't these two commands both send 'foo' back to my screen? 
| (Octave 3.0.0 on gentoo/amd64, but I noticed it in earlier Octave versions 
| too). 
| 
| octave:1> system ("echo foo; exit 2",1,"async")
| ans =  829
| octave:2> foo
| 
| octave:2> system ("echo foo; exit 2",1,"sync")
| ans =  2
| octave:3>
| octave:3>
| 
| In particular, i would have thought the sync version should do it.

No, the sync version should return the output from the system command
(you specified that with the second argument of 1):

  octave:1> [status, output] = system ("echo foo; exit 2",1,"sync")
  status =  2
  output = foo

This is documented, though I suppose not very clearly.  I would
welcome a patch that improved the doc string.

| Sooo...am i totally misunderstanding how system should work? 
| And either way, how do I get 'edit' to work?

If your problem is with edit, then how about sending a precise recipe
for duplicating the problem your are having with it?

jwe


More information about the Help-octave mailing list