Exit the current Octave session. If the optional integer value
status is supplied, pass that value to the operating system as the
Octave's exit status.
— Built-in Function: atexit (fcn)
Register a function to be called when Octave exits. For example,
function print_fortune ()
printf ("\n%s\n", system ("fortune"));
fflush (stdout);
endfunction
atexit ("print_fortune");