From help-octave-request at che dot utexas dot edu Tue Jan 17 14:29:44 1995 Subject: Re: External editor From: John Eaton To: chris at astri dot uni dot torun dot pl (Krzysztof Gozdziewski) cc: help-octave at che dot utexas dot edu Date: Tue, 17 Jan 95 14:29:23 CST chris at astri dot uni dot torun dot pl (Krzysztof Gozdziewski) wrote: : I have a problem with calling an external editor from within a session : of octave. If I try to define a command like : : ed = system( "joe", "myfun.m" ) : : the editor 'joe' hangs the session at the start and I have to kill : the process of octave. The same is with vi. This is from the manual distributed with 1.1.0: If you want to execute a shell command and have it behave as if it were typed directly from the shell prompt, you may need to specify extra arguments for the command. For example, to get `bash' to behave as an interactive shell, you can type system ("bash -i >/dev/tty"); The first argument, `-i', tells `bash' to behave as an interactive shell, and the redirection of the standard output stream prevents any output produced by `bash' from being sent back to Octave, where it would be buffered until Octave displays another prompt. So, I think it might work to do something like function ed (file) system (["joe ", file, " >/dev/tty"]); endfunction Of course, this could be improved by checking the argument to make sure it exists and is a string, etc. You might also want to look at the edit_history command, which will start the editor for you on a list of previous commands from Octave's history list. : We use octave on SunOS4.1.3 and 5.3, the shell is tcsh. : : Sorry if I overlooked a strightforward solution to this problem. : If someone knows it please replay. I need the editor for : writing function and program files when having only one text terminal. On Sun systems with tcsh you should be able to use job control to suspend Octave while you edit and restart it when you are ready to go on. Is there some reason this doesn't work properly for you? jwe