BASH and Octave: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 21: Line 21:
</syntaxhighlight>}}
</syntaxhighlight>}}


Now, when you have run Octave, have done something in that session that you want to save to a script (a {{Codeline|*.m}} file), then, on the command line, you just type {{Codeline|octave_save_last_session}}, and the last session is copied from the {{Codeline|~/.octave_hist}} file and saved to {{Codeline|octave_save_last_session.m}}. You can edit that file to remove parts you don't want to save, or you can re-execute the commands by {{Codeline|octave --persist octave_save_last_session.m}}.
Now, imaging you have 'played around' in an interactive Octave session to try/test something: you want to save the commands you just used to not-forget. Just close the Octave session. If (in Linux) you close Octave that you have started from the command line, you will automatically return to the command line. Now you want to have a seperate copy of your last session put in a file (a {{Codeline|*.m}} file). On the command line, you just type {{Codeline|octave_save_last_session}}, and the last session (only!) is copied from the {{Codeline|~/.octave_hist}} file and saved to {{Codeline|octave_save_last_session.m}}. You can edit that file to remove parts you don't want to save, or you can re-execute the commands by {{Codeline|octave --persist octave_save_last_session.m}}.
22

edits