(octave.info)Quitting Octave


Next: Getting Help Prev: Invoking Octave from the Command Line Up: Getting Started
Enter node , (file) or (file)node

2.2 Quitting Octave
===================

Shutdown is initiated with the ‘exit’ or ‘quit’ commands (they are
equivalent).  Similar to startup, Octave has a shutdown process that can
be customized by user script files.  During shutdown Octave will search
for the script file ‘finish.m’ in the function load path.  Commands to
save all workspace variables or cleanup temporary files may be placed
there.  Additional functions to execute on shutdown may be registered
with ‘atexit’.

 -- : exit
 -- : exit (STATUS)
 -- : quit
 -- : quit (STATUS)
     Exit the current Octave session.

     If the optional integer value STATUS is supplied, pass that value
     to the operating system as Octave’s exit status.  The default value
     is zero.

     When exiting, Octave will attempt to run the m-file ‘finish.m’ if
     it exists.  User commands to save the workspace or clean up
     temporary files may be placed in that file.  Alternatively, another
     m-file may be scheduled to run using ‘atexit’.

     See also: Note: atexit.

 -- : atexit (FCN)
 -- : atexit (FCN, FLAG)
     Register a function to be called when Octave exits.

     For example,

          function last_words ()
            disp ("Bye bye");
          endfunction
          atexit ("last_words");

     will print the message "Bye bye" when Octave exits.

     The additional argument FLAG will register or unregister FCN from
     the list of functions to be called when Octave exits.  If FLAG is
     true, the function is registered, and if FLAG is false, it is
     unregistered.  For example, after registering the function
     ‘last_words’ above,

          atexit ("last_words", false);

     will remove the function from the list and Octave will not call
     ‘last_words’ when it exits.

     Note that ‘atexit’ only removes the first occurrence of a function
     from the list, so if a function was placed in the list multiple
     times with ‘atexit’, it must also be removed from the list multiple
     times.

     See also: Note: quit.


automatically generated by info2www version 1.2.2.9