Interleaving and Diary Questions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Interleaving and Diary Questions

Martin Senator-2

1) I can debug most errors simply and quickly if I can see my commands
interleaved with octave's responses.   My problem is that I like to reuse all
(edited) commands after fixing each error.  So, I put the commands in a command
file and run it.  When I do, I cannot get interleaved output.

2) The problem here is that I can't get 'diary' to work when the
subsequent commands come from a command file.


Reply | Threaded
Open this post in threaded view
|

Interleaving and Diary Questions

John W. Eaton-6
Martin Senator <[hidden email]> wrote:

: 1) I can debug most errors simply and quickly if I can see my commands
: interleaved with octave's responses.   My problem is that I like to reuse all
: (edited) commands after fixing each error.  So, I put the commands
: in a command file and run it.  When I do, I cannot get interleaved output.

This may not be exactly what you want, but it may help.  If you are
putting all of your commands in a file to execute, you can do this,

  octave --echo-commands script-file

and Octave will print each command as it is executed, followed by the
output that is produced.  The commands are preceded by the value of
the built-in variable PS4 (the default is "+ ").  If you would prefer
some other string prefix, you can change the value of PS4 at the top
of your script.

(This is somewhat like running `/bin/sh -xv'.)

Version 1.1.1 does not have a way to turn command echoing on or off
once Octave is started.  That should probably change for 1.2...

: 2) The problem here is that I can't get 'diary' to work when the
: subsequent commands come from a command file.

This is also the way Matlab appears to work.

jwe

Reply | Threaded
Open this post in threaded view
|

Re: Interleaving and Diary Questions

Martin Senator-2
In reply to this post by Martin Senator-2
Hi

   "This may not be exactly what you want, but it may help.  If you are
   putting all of your commands in a file to execute, you can do this,

     octave --echo-commands script-file"

Thanks.  This worked.  However, I still have a problem with diary.

        : 2) The problem here is that I can't get 'diary' to work when the
        : subsequent commands come from a command file.

    "This is also the way Matlab appears to work."

I don't remember exactly how Matlab works.  I think I could turn on
the diary at the command prompt; then call the source-file; have an
'echo on' command at the top of the source-file and an echo-off at the
bottom (to get my interleaved output at the terminal); and then turn
the diary off at the command line prompt after the source-file runs.
In Matlab, this would give a diary-file with interleaved commands and
output and interleaved results at the terminal.

In Octave, however, when I run the 'octave --echo-commands
script-file' command with a diary on command as the first command in
the script file, a  zero-character diary file results.

Is there any way to get both interleaved output at the terminal
AND an interleaved diary file?

Or even to run a script file and get ONLY the diary-file output?

ms